Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Orphaned default - problem

807588Jan 26 2009 — edited Jan 26 2009
I am a studying SCJP and am a newbie. My tutor wanted me to write a simple program to display the default values of data types. I tried it in the following ways, but there is an error - orphaned default. How do I fix this??
-----------------------------------------------------------------------
class H{
public static void main(String[] args)
{ boolean x; {if (x==x)
{
}
default:}
}
}

--------------------------------------------------------------------------
class W{
public static void main(boolean x, boolean y)
{ if (x==y)
{
}
default:
}
}


Please help
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 23 2009
Added on Jan 26 2009
11 comments
402 views