Submitted by heartin on Fri, 11/01/2013 - 03:48
Conventions Used:
[N] - Note to remember
Submitted by heartin on Tue, 10/29/2013 - 09:29
Access modifiers are used to specify the accessibility or access levels of a type (class, interface) and its members (methods, variables and even constructors). There are three access modifiers and four access levels in Java. The three access modifiers are are private, protected and public. Four access levels (from most restricted to least restricted) are private, default (no modifier), protected and public.
Submitted by heartin on Sat, 10/26/2013 - 13:10
Constructors are used to initialize the state of an object when it is created. Constructors are invoked while creating objects, usually after the new keyword. A child class may also invoke a super constructor using the super keyword to initialize the parent object.
Constructors are similar in syntax to methods, but without any return type and have the same name as that of the class (case sensitive).
MyClass{
MyClass(){
}
Submitted by heartin on Wed, 10/23/2013 - 08:52
The “this keyword” in Java refer to the the current object (current instance). All your instance variables may be referred as 'this.variableName' even though it is implicit in most cases.
The “this keyword” is mostly useful in below cases:
-
Refer to instance variables of a class when a local variable has precedence over it.
Submitted by heartin on Tue, 10/22/2013 - 11:30
Java is a programming language that follows the Object-Oriented Programming (OOP) principles. OOP model focusses on realworld objects to model applications. A real world object will have some properties and some behaviour. For example, human object will have properties like height, weight etc. and behaviours like walk, run, talk, etc.
Pages