Last active
March 29, 2016 00:28
-
-
Save RameshRM/aa51280fbc6ece3dfa0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Runnable w/a Private Variable **/ | |
package com.api.specs; | |
/** | |
* Hello world! | |
* | |
*/ | |
public class App { | |
public static void main(String[] args) { | |
Todo todo = new Todo(); | |
todo.doSome(); | |
} | |
} | |
class Todo { | |
private String Hello = "Hello"; | |
public void doSome() { | |
Runnable r = new Runnable() { | |
public void run() { | |
System.out.println(Hello); | |
} | |
}; | |
r.run(); | |
} | |
/** | |
* This needs Final | |
* **/ | |
public void doSomeThingElse() { | |
final String helloWorld = "Hello World"; | |
Runnable r = new Runnable() { | |
public void run() { | |
System.out.println(helloWorld); | |
} | |
}; | |
r.run(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment