language: Java (sun-jdk-1.7.0_10)
date: 427 days 6 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class Student{
 
  int age;
 
  public void setAge(int age){
    this.age=age;
  }
 
  public int getAge(){
    return age;
  }
 
    @Override
    public String toString() {              // Called for instance when
        return "Student with age " + age;   // the student should be printed
    }
 
}
 
 
class Main {
 
  public static void main(String args[]){
 
    Student stud= new Student();
    Student stud1= new Student();
    stud.setAge(15);
    int i=stud.getAge();
    String a=new String("Hello");
    System.out.println(stud);
    System.out.println(stud1);
    System.out.println(a);
  }
 
}