Monday, August 20, 2007

Saturday, August 18, 2007

String VS StringBuffer : Bytecode level

Hi
found this article on String VS String Buffer and the interesting part is difference is explained in terms of bytecode ...
The byte code didnt make MUCH sense to me ... EXCEPT that StringBuffer creates less bytecode that string.

:)

Tuesday, August 14, 2007

Java Puzzlers

Hi
see this .. best java puzzles ever
http://video.google.com/videoplay?docid=9214177555401838409
wat say ??

Adding my bit of cheese on it try predicting output of


class Some_Runnable implements Runnable {
public void run() {
System.out.println("Some_Runnable");
}
}

class Some_Thread extends Thread {
Some_Thread() {}
Some_Thread(Runnable r) {
super(r);
}
public void run() {
System.out.println("Some_Thread");
}
}

class Some_Other_Thread extends Thread {
Some_Other_Thread() {}
Some_Other_Thread(Runnable r) {
super(r);
}
public void run() {
System.out.println("Some_Other_Thread");
}
}

class default_thread extends Thread {
default_thread() {
System.out.println("IN default thread ");
}
default_thread(Runnable r ){
super(r);
}
// NO RUN() METHOD
}

public class Class2 {
public static void main(String args[]) {
// lang.Thread class implements Runnable
new Some_Thread().start();
new Some_Thread(new Some_Runnable()).start();
new Some_Thread(new Some_Other_Thread()).start();

new Thread(new Some_Runnable()).start();
new Thread(new Some_Other_Thread()).start();

System.out.println("Default Thread ... doesnt override run()");
new default_thread().start(); // ok
new default_thread(new Some_Runnable()).start();
new default_thread(new Some_Other_Thread()).start();

}
}

Monday, August 13, 2007

Oscars of the Software Industry

I am hearing it for the first time ..
may be coz i am not that much aware of the industry awards
never thought of exploring the same
But the findngs are interesting

Oracle Database 10g' is the winner of the best enterprise database and 'Oracle ADF Business Components' the best Java Component as announced by the 'Oscars of the Software Industry'.

Check out this link:
http://jdj.sys-con.com/read/171303_3.htm

Thursday, August 9, 2007

Observable Collection

came accross this observable collection
http://commons.apache.org/sandbox/events/apidocs/org/apache/commons/events/observable/ObservableCollection.html

something useful and nice ..
didnt get time to try it out ...
but soon will ...

this thread talks more about it

Wednesday, August 1, 2007

Out of Box : Java Tuts

Hi
Found these ..
Best way for a novice to start learning java ...
Out of box thinking my friend ...
Just doing my bit to promote them

Start with installing JDK



Make a Hello World



Learn about Variable and Arithmetic



World Famous If statements



Java and OOP



Loops



Switch Statement



Java Arrays



Cheerz !!
Lavnish

Child Class Should do all Initialization

Hi

consider the following code... it will give compile time error


class memberClass
{
memberClass()
{
System.out.println("Member Class constructor called");
}
};

class ParentClass
{
ParentClass()
{
System.out.println("Parent Class constructor called");
}
}

public class ChildClass
{
private memberClass = new memberClass();

public ChildClass()
{
super(memberClass);
// super has to be the 1st call in the constructor ..
// cant pass it memberClass as argument : ERROR
// SOLUTION : do all initialization in Child
}

public static void main(String[] args)
{
System.out.println("Hello World!");
}
}



Error : cannot reference this before superclass constructor has been called


package try_project1;

class memberClass
{
memberClass()
{
System.out.println("Member Class constructor called");
}
};

class ParentClass
{
ParentClass( )
{
System.out.println("Parent Class constructor NO INITIALIZATION ");
}
}

public class ChildClass extends ParentClass
{
private memberClass memc= new memberClass();

public ChildClass()
{
super();
System.out.println("do ALL INITIALIZATION in child Class");
}

public static void main(String[] args)
{
System.out.println("Child Class Hello World!");
ChildClass cc = new ChildClass();
}
}