1.实现用户登陆功能,在控制台输入用户名和密码,然后判断输入是否正确并输出结果。
import java.util.Scanner;
public class DJ16word1 {
public boolean login(String name,String password){
boolean judge=false;
if(“jack”.equalsIgnoreCase(name)&&“123456”.equals(password)){
judge=true;
}
return judge;
}
@SuppressWarnings(“resource”)
public static void main(String[] args) {
DJ16word1 l=new DJ16word1();
Scanner i=new Scanner(System.in);
System.out.print(“请输入用户名:”);
String name=i.next();
System.out.print(“请输入密码:”);
String password=i.next();
if(l.login(name, password)){
System.out.println(“登陆成功!”);
}else{
System.out.println(“登陆失败!”);
}
}
}
2.在控制台输入学生姓名、年龄、性别和学校,然后模拟将该学生信息储存导数据库中。
public class DJ16word2Student {
priv