The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes output of the thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "output of the thread" Watch "output of the thread" New topic

output of the thread

srilatha annepu

Joined: Jun 29, 2006
Posts: 28
public class Tux extends Thread{
static String sName = "vandeleur";
public static void main(String argv[]){
Tux t = new Tux();
public void piggy(String sName){
sName = sName + " wiggy";
public void run(){
for(int i=0;i < 4; i++){
sName = sName + " " + i;

Compilation and probably output of "vandeleur" but possible output of "vandeleur 0 1 2 3"

public class Checket extends Thread{
static String sName="venture";
public static void main(String argv[]){
Checket c = new Checket();
public void everton(String s){
public void run(){

Compilation and output "vicarage" or possibly "ventureboatwright"

please see the outputs for both

for the first output why is it "vandeleur" and not "vandeleur wiggy";
when it is for the second question please help
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023

What is variable hiding and shadowing?
[ July 07, 2006: Message edited by: wise owen ]
I agree. Here's the link:
subject: output of the thread
It's not a secret anymore!