Created
September 5, 2017 07:07
-
-
Save hyperion0201/a7b86b148c0e7d613eccc4e76ec8e06e to your computer and use it in GitHub Desktop.
The java classes for testing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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