Search

// write a program in java which initialize the object of class through parameterized constructor.

CODE


class a
{
a( )
{
System.out.println("In a\'s Contructor...");
}
}
class b extends a
{
b(String s)
{
System.out.println("In b\'s constructor...");
System.out.println(s);
}
}
public class par
{
public static void main(String [ ]args)
{
b obj=new b("Hello from java!");
}
}

OUTPUT DISPLAY



Share this article :
 

Post a Comment

 
Support : everytricks4.blogspot.in/ | Johny Template | Mas Template
Copyright © 2011. Computer Tricks - All Rights Reserved
Creating Website Published by
Proudly powered by Blogger