Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test
- {
- public static void main(String[] args)
- {
- Runnable runnable = getRunnable();
- Thread thread = new Thread(runnable);
- thread.start();
- }
- public static Runnable getRunnable()
- {
- class IntPair
- {
- int a;
- int b;
- public int sum()
- {
- return this.a+this.b;
- }
- }
- final IntPair p = new IntPair();
- p.a = 10;
- p.b = 17;
- Runnable runnable = new Runnable()
- {
- class AnotherIntPair
- {
- int a;
- int b;
- }
- public void run()
- {
- /*while(true)
- {*/
- System.out.println(p.sum());
- /* try
- {
- Thread.sleep(1000);
- }
- catch(Exception e)
- {
- return;
- }
- }*/
- }
- };
- return runnable;
- }
- }
Add Comment
Please, Sign In to add comment