Tuesday, April 22, 2008

Java Question of the Day- 22/04/2008

What is the output? (Don’t compile or execute this program)



public class Anyonecancode {


static void main(String[] args) {

String s1 = new String("Anyone can Code");
String s2 = new String("Anyone can Code");

StringBuffer sb1 = new StringBuffer("Anyone can Code");
StringBuffer sb2 = new StringBuffer("Anyone can Code");

System.out.println(sb1 == sb2 && s1 == s2);
System.out.println(s1.equals(s2) || sb1.equals(sb2));

}

}

a)
true

true

b)
false
false

c)
false
true

d)
true
false

e)
other

Thursday, April 10, 2008

First step with java

Java program is mostly a collection of objects talking to other objects by invoking each other's methods. Every object is of a certain type, and that type is defined by a class or an interface. Most Java programs use a collection of objects of many different types

Class : A template that describes the kinds of state and behavior that objects of its type support.

Object : At runtime, when the Java Virtual Machine (JVM) encounters the new keyword, it will use the appropriate class to make an object which is an instance of that class. That object will have its own state, and access to all of the behaviors defined by its class.

State (instance variables) : Each object (instance of a class) will have its own unique set of instance variables as defined in the class. Collectively, the values assigned to an object's instance variables make up the object's state.

Behavior (methods) : When a programmer creates a class, she creates methods for that class. Methods are where the class' logic is stored. Methods are where the real work gets done. They are where algorithms get executed, and data gets manipulated

ePlantAnalyzer - Plant Identification System by Analyzing Leaf Patterns by Saneth Dharmakeerthi

Search

Google
 

Sun Developer Network Highlights

Java and J2EE

Rational Functional Tester

Rational Functional Tester

Latest headlines from JavaWorld

JavaRanch Programmer Certification (SCJP)

Oracle JDeveloper News

Life of a java disciple

Java Studio Creator Headlines