Instance Variables: =================== The data members of the class which cannot share same on all objects are called as "Instance Variables". Ex: package IO.AshokIT.Java; class Student{ int sid; String sname; void display() { System.out.println("Student Id = "+sid); System.out.println("Student Name = "+sname); } } public class MainClass { public static void main(String[] args) { Student stu1 = new Student(); stu1.sid = 10; stu1.sname = "Karthik"; stu1.display(); Student stu2 = new Student(); stu2.sid = 20; stu2.sname = "Keerthi"; stu2.display(); stu1.sid = 30; stu1.display(); stu2.display(); } } ================== static keyword: =============== ==> static keyword is one of the non-access modifier. ==> static keyword we can use for: variables, methods and inner classes. ==> static keyword cannot allow to use for: outer classes and constructors. ==> static keyword we can use to create variable, methods and inner classes which can share among multiple objects of the same class equally. static variables: ================= ex: class BankingSystem{ long accountNumber; // instance variable double amount; // instance variable static String ifsccode; // static variable } public class MainClass{ public static void main(String[] args) { BankingSystem user1 = new BankingSystem(); user1.accountNumber = 12346543210l; user1.balance = 12098.00; user1.ifsccode = "XYZ11223"; BankingSystem user2 = new BankingSystem(); user2.accountNumber = 10203040506l; user2.balance = 2098.0; user2.ifsccode = "XYZ11223"; } } ==> The static variable can define for the class but not for the object. ==> we can initialize the static variable using the class name. Syntax: className.static-variable-name = value; ==> If the static variable can modify through any object, then it can reflect on all object automatically. package Java.IO.AshokIT; class StaticMembers{ int x; static int y; void display() { System.out.println("x = "+x); System.out.println("y = "+y); } } public class MainClass { public static void main(String[] args) { StaticMembers sm1 = new StaticMembers(); sm1.x = 100; StaticMembers.y = 200; sm1.display(); StaticMembers sm2 = new StaticMembers(); sm2.display(); sm1.y = 1000; sm1.display(); sm2.display(); } } ========================================================= Q: WAP IN JAVA TO CREATE THE CLASS "BANKING SYSTEM". DEFINE DATA MEMEBRS AS ACCOUNT NUMBER, BALANCE AND IFSC CODE. HERE DEFINE THE IFSC AS STATIC TYPE. CREATE TWO METHODS WHICH ACCEPT AMOUNT AND IFSC CODE FOR WITHDRAW AND DEPOSIT.