问题:定义一个网络用户类,要处理的信息有用户ID、用户密码、email地址。在建立类的实例时,把以上三个信息都作为构造函数的参数输入,其中用户ID和用户密码时必须的,缺省的email地址是用户ID加上字符串"@gameschool.com"代码:importjava.util.*;classInternet{ privateStringID,password,email; publicInternet(){ } publicvoidsetInternet(StringID,Stringpassword,Stringemail){ this.ID=ID; this.password=password; this.email=email; } publicvoidgetInternet(){ System.out.println(ID+","+password+","+email); }}publicclassPerson{ publicstaticvoidmain(String[]args){ Scannerreader=newScanner(System.in); StringID=reader.nextLine(); Stringpassword=reader.nextLine(); Stringemail=reader.nextLine(); if(ID=="null"||password=="null") System.out.println("请输入用户信息!"); if(email=="null") System.out.println(ID+","+password+","+ID); Internetone=newInternet(); one.setInternet(ID,password,email); }}代码还没写完,我想先试试能否判断,结果if条件语句不能执行,想知道为什么,需要如何改呢?请大神求教!!! |