Skip to content

Instantly share code, notes, and snippets.

@hyperion0201
Created September 5, 2017 07:07
Show Gist options
  • Save hyperion0201/a7b86b148c0e7d613eccc4e76ec8e06e to your computer and use it in GitHub Desktop.
Save hyperion0201/a7b86b148c0e7d613eccc4e76ec8e06e to your computer and use it in GitHub Desktop.
The java classes for testing.
import java.util.*;
class Student { // Initialising the main class
int studentage;
public Student(String name) {
System.out.println("Name choosen is : " + name);
}
public void setAge(int age) {
studentage = age;
}
public int getAge() {
System.out.println("Student's age is : " + studentage);
return studentage;
}
public static void main(String[] args) {
Student myStudent = new Student("Hoang Minh Hieu");
// myStudent.getName = "Hoang Minh Hieu";
myStudent.setAge(18);
myStudent.getAge();
Student myStudent2 = new Student("Hoang Van Dung");
myStudent2.setAge(22);
myStudent2.getAge();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment