Click here to watch in Youtube :
https://www.youtube.com/watch?v=ITGCiwdIuuA&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java Instance Variable |
public class Student { String name; // instance variable int age; // instance variable void printInstanceVariable() { System.out.println("name : "+ name); System.out.println("age : "+ age); System.out.println("**********************"); } }
public class StudentDemo { public static void main(String[] args) { Student john = new Student(); john.name = "John"; john.age = 6; Student dave = new Student(); dave.name = "Dave"; dave.age = 7; Student juli = new Student(); juli.name = "juli"; juli.age = 5; john.printInstanceVariable(); dave.printInstanceVariable(); juli.printInstanceVariable(); } }
name : John age : 6 ********************** name : Dave age : 7 ********************** name : juli age : 5 **********************To Download VariableDemoInstanceApp Project Click the below link
https://sites.google.com/site/javaee4321/java/VariableDemoInstanceApp.zip?attredirects=0&d=1
See also:
No comments:
Post a Comment