# ':' turning into label statement



## redhat (Feb 3, 2008)

I use the BlueJ compiler to write and run Java programmes. 
(I'm in school, n d board prescribes that )
While writing a program, i experianced an unusual error, whenever I type ":", it turns into a label statement, and I cant use it for declaring cases in Switch...


```
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
/**
 * Write a description of class Designs here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Designs
{

    public static void main(String[] args) throws IOException
    {
        boolean cont = true;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        do
        {
            loop:cont = true;
            System.out.println("/fWelcome to the Designs Class...");
            System.out.println("01. Design 01");
           
            System.out.print("Please Select an option : ");
            try
            {
                int opt = Integer.parseInt(br.readLine());
            }
            catch(Exception oe)
            {
                System.out.println("Error in input :/n" + oe);
                break;
            }
            Switch(opt);
            {
                case 1:
                System.out.println();
                default:
                break loop;
            }
        } while(cont);
    }
}
```
PS I have removed some parts of the code.

ERROR:

```
Designs.java:46: orphaned case
                case 1:
                ^
Designs.java:48: orphaned default
                default:
                ^
2 errors
```

Can someone please help?

*THREAD CLOSED...​*
Sorry, I found my error:
I was referencing to variable opt, which was out of scope
Its limited to the try block...


----------



## The_Devil_Himself (Feb 3, 2008)

redhat said:


> *THREAD CLOSED...​*



no it isn't.


----------



## MetalheadGautham (Feb 3, 2008)

The_Devil_Himself said:


> no it isn't.


+1


----------



## redhat (Feb 3, 2008)

OK,
Mods *PLEASE* close this thread.....


----------



## Cyclone (Feb 3, 2008)

MetalheadGautham said:


> +1



1 more! 

Sorry, I just couldn't resist!


----------



## Faun (Feb 3, 2008)

+1 
still


----------



## Pathik (Feb 3, 2008)

+1
Me bhi karunga. me bhi karunga..


----------



## Garbage (Feb 3, 2008)

The_Devil_Himself said:


> no it isn't.


post++


----------



## Faun (Feb 3, 2008)

while(true)
{

call(mods, close_the_thread);
sleep(MAX)

};


----------



## MetalheadGautham (Feb 4, 2008)

T159 said:


> while(true)
> {
> 
> call(mods, close_the_thread);
> ...


make it

```
getorder();
while(true())
 {
   if(need=={close})
    {
      call(mods, close_the_thread);
    }


   else
    {
      sleep(MAX);
      break();
    }

}
```


----------



## Faun (Feb 4, 2008)

MetalheadGautham said:


> make it
> 
> ```
> getorder();
> ...



KIS 

why do u put break after sleep ? bad...bad... pgming


----------



## MetalheadGautham (Feb 4, 2008)

T159 said:


> KIS


depends on weather you are a guy or a girl 


T159 said:


> why do u put break after sleep ? bad...bad... pgming


mine was C++. Sleep was to help us leave this forum .


----------



## Faun (Feb 4, 2008)

MetalheadGautham said:


> depends on weather you are a guy or a girl
> 
> mine was C++. Sleep was to help us leave this forum .


KIS = Keep it simple


----------



## MetalheadGautham (Feb 4, 2008)

T159 said:


> KIS = Keep it simple


that was a joke


----------

