public class Message {
private static String the_message;
private static java.util.Date the_date;
public Message(String string) {
}
public static void main (String[] args) {
the_date = new java.util.Date();
the_message = "Ryan";
Message m3 = new Message( "Ryan" );
m3.println1();
m3.println2();
}
public static void println1( ) {
String long_message = " Hello World! My name is " + m3 + ". The date is " + the_date;
String lower_case = long_message.toLowerCase();
System.out.println( lower_case );
}
public static void println2( ) {
String long_message = " Hello World! My name is " + the_message +
". The date is " + the_date;
String upper_case = long_message.toUpperCase();
System.out.println( upper_case );
}
}
我希望输出我的名字 但是在写long_message的时候写m3就无法识别
怎么才能让他识别并输出名字(而不是像后面那个重新创建一个新的变量)
|