Y we create objects in java.y we use constructor in java. what is static variables?
y we create objects in java? This question tells me that you know only the term “JAVA” in java language. Java is all about classes and objects. Classes is some thing like piece of code that has capacity to do every thing but cannot do by itself. You have to create object of that class to get the work done intended by class. Google for classes and object in OOP…there is hell lot a tutorial out there… y we use constructor in java? In any OOP, constructor means that method which initializes classes. How it works is, constructor method get executed automatically when you create object of any class. If a method in a class has same name as class name, that is the constructor method in that class. what is static variables? Well, variables in class are like non physical variable or that doesn’t actually hold memory…when you create object of class, object hold some memory, and it is divided to variables with in object or class. For normal variable each object has their own copy of memory,