Submitted by heartin on Thu, 10/23/2014 - 10:07
The while statement
The “while loop” is an alternative to “for loop”. a “for loop” is usually used when the number of times the block is to be executed is known. A “while loop” is usually used when the number of times the block is to be executed is not known, like prompting the user whether to stop executing during every iteration.
The syntax of “while loop” is:
while (<condition>) <statements>;
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 Wed, 09/19/2012 - 22:14
A class represent the properties and behabiour of an object. An methods represent these behaviours.
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 Mon, 09/30/2013 - 10:05
Decision control statements can change the execution flow of a program.
Decision control statements in Java are:
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 will have properties like height, weight etc. and behaviours like walk, run talk, etc.
Submitted by heartin on Sun, 10/20/2013 - 21:31
Looping constructs in Java are:
Do while statement
We will see for and for-each here. We will see while, do while, break and continue statements in next note.
The for statement
Syntax of for loop is:
Submitted by heartin on Tue, 11/27/2012 - 08:27
Inner class is a class within another class, method or block. An inner class can be one of the following four types: Anonymous, Local, Member and Nested top-level.
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).
Submitted by heartin on Sat, 01/19/2013 - 20:25
In this article, we start by discussing the difference between multithreading and multitasking (or difference between threads and processes), then discussing the thread states, different ways of creating threads and a simple thread example to make things clear. We will also learn what are deamon threads.