top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Examples for invisisble objects in java?

+2 votes
310 views
Examples for invisisble objects in java?
posted Jan 11, 2014 by Prasad

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Not sure what you are looking into check the following example

public void run() {
    try {
        Object foo = new Object();
        foo.doSomething();
    } catch (Exception e) {
        // whatever
    }
    //  the object assigned to the variable foo will become invisible
    //  after leaving the try/catch block 
    while (true) {
         // do stuff 
    } 
}
answer Jan 11, 2014 by Tarun Singhal
...