User.where.not(id: [@user.id] + @user.following.ids).order('RANDOM()').first
下面的程序错误并输出以下内容
// This portion works
import java.util.Scanner;
class test {
private static Scanner inp;
public static void main(String[] args) {
inp = new Scanner(System.in);
System.out.println("Input Password");
int n = inp.nextInt();
System.out.println(n);
if(n!=234) {
System.out.println("Denied Acess");
} else {
System.out.print("Password Accepted");
}
答案 0 :(得分:1)
import java.util.Scanner;
class Main {
private static Scanner inp;
public static void main(String[] args)
{
inp = new Scanner(System.in);
System.out.print("Input Password: ");
int n = inp.nextInt(); // For int
System.out.println(n);
if(n != 234)
{
System.out.println("Denied Access");
}
else
{
System.out.println("Password Accepted");
}
/* Scanner has already been initialized, don't create
a new one, use existing one, don't try and print the
Scanner because it is of type Scanner. */
System.out.print("Input Text to encrypt: ");
String m = inp.next(); // For String
System.out.println(m);
}
}
有关扫描仪课程的说明,请参阅此处:http://www.javatpoint.com/Scanner-class