Naveen KumarBS

Greenhorn
+ Follow
since Dec 22, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Naveen KumarBS

hai iam Naveen Kumar write now iam taking suncertification scjp1.5

i have a doubt in the constuctors as we know that constructors donot have return type but i have used return type in constructor and it is still compiling it is not giving error, can anybody please tell me whether it is using default constuctor because its giving the value as '0' for both x and y but it should give compilation error when i run this program

here is the program and i have complied it in jdk1.5 version


public class testconstructor{

int x,y;

void testconstructor(){

x=10;
y=20;
}

void printme(){

System.out.println("x value "+x+"y value"+y);
}

public static void main(String ar[]){

testconstructor con1=new testconstructor();

con1.printme();
}
}