标题:[求助] java标识符错误
取消只看楼主
yfann
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2007-3-23
 问题点数:0 回复次数:1 
[求助] java标识符错误

package study;
import java.util.Scanner;
public class NameUse{
public static void main (String[] args){
System.out.println("Please enter your name:");
Name test= new Name();
System.out.println("Your Name is "+test.toString()+"!");
}

}
class Name
{ Scanner keyboard=new Scanner(System.in);
private String firstname =keyboard.next();
private String lastname =keyboard.next();
firstname=firstname.toLowerCase();//******************************1
lastname=lastname.toLowerCase();//********************************2
public void setFirstName(String firstname)
{this.firstname = firstname;
}
public String getFirstName()
{return this.firstname;
}
public void setLastrName(String lastname)
{this.lastname = lastname;
}
public String getLastName()
{return this.lastname;
}
String fs,ls,fn,ln,fl,ll;
public String toString(){
fs=firstname.substring(1,2);
fs=fs.toUpperCase();
ls=lastname.substring(1,2);
ls=ls.toUpperCase();
fn=firstname.substring(2);
ln=lastname.substring(2);
fl=fs+fn+firstname.substring(0,1)+"ay";
ll=ls+ln+lastname.substring(0,1)+"ay";
return fl+" "+ll;
}
}
为什么在编译时1,2处发生'需要标识符'错误

搜索更多相关主题的帖子: java 符错误 
2007-04-12 12:27
yfann
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2007-3-23
得分:0 
真是太感谢了
2007-04-12 14:38



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-131279-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.188826 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved