Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Threads

 
Srinivasa Gundapu
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class Tux extends Thread{
static String sName = "vandeleur";
public static void main(String argv[]){
Tux t = new Tux();
t.piggy(sName);
System.out.print(sName);
}
public void piggy(String sName){
sName = sName + " wiggy";
start();
}
can anyone tell me the output of this program i am pasting the code for reference.and explain
public void run(){
for(int i=0;i < 4; i++){ sName = sName + " " + i; } }}
1) Compile time error
2) Compilation and output of "vandeleur wiggy"
3) Compilation and output of "vandeleur wiggy 0 1 2 3"
4) Compilation and probably output of "vandeleur" but possible output of "vandeleur 0 1 2 3"
 
Sridhar Srikanthan
Ranch Hand
Posts: 366
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Srinivas,
You can check this
link
HTH
Sri
 
Jasper Vader
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Srinivasa - i guess you've been to examulator.com recently too eh? !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic