Skip to content

Instantly share code, notes, and snippets.

@RameshRM
Last active March 29, 2016 00:28
Show Gist options
  • Save RameshRM/aa51280fbc6ece3dfa0f to your computer and use it in GitHub Desktop.
Save RameshRM/aa51280fbc6ece3dfa0f to your computer and use it in GitHub Desktop.
/** 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