Would you like to react to this message? Create an account in a few clicks or log in to continue.

override toString() ͧʷ¹

 :: ¹ҡѹ :: ѡ String ѹ

Go down

 override toString() ͧʷ¹ Empty override toString() ͧʷ¹

ตั้งหัวข้อ  Admin Fri May 23, 2008 3:49 pm

class Student {

private String ;
private int ;

public Student(String , int ) {
this. = ;
this. = ;
}

public String toString() {
return " "++" "++" ";
}


}





**********************************************************

package string;

public class toString {

public static void main(String[] args) {

Student s1 = new Student("",25);
Student s2 = new Student("ѹ",30);

System.out.println(s1); // ¡ toString();
System.out.println("---------------------------------");
System.out.println(s2); // ¡ toString();

}

}






šѹ

25
---------------------------------
ѹ 30
Admin
Admin
Admin

จำนวนข้อความ : 112
Registration date : 18/05/2008

http://chawban.chocoforum.com

ขึ้นไปข้างบน Go down

ขึ้นไปข้างบน

- Similar topics

 :: ¹ҡѹ :: ѡ String ѹ

 
Permissions in this forum:
คุณไม่สามารถพิมพ์ตอบ