Mercurial > hg > testrepo
view Hello.java @ 102:2397ff9babf5
Testing push access: added a random number generator method
author | Alex Macdonald <almacdon@redhat.com> |
---|---|
date | Wed, 05 Oct 2016 15:19:26 -0400 |
parents | 14b0d6849b19 |
children | cffc7a3f592c |
line wrap: on
line source
import java.io.*; public class Hello { public static void main (String[] args) { System.out.println("nw task 1"); Hello.hello(); System.out.println (args.length > 0 ? args[0] : "Unknown person"); World.world(); new Mandelbrot(); System.out.println(""); System.out.println("nw task 2"); new Something().doit(); System.out.println(new Something().dontdoit()); System.out.println(new Something().dodoitanddontdoit()); Something.yay(1); System.out.println(""); System.out.println("nw task 3"); new DefinitelyNotSomething().doSomething(); new DefinitelyNotSomething().SomethingElse(); System.out.println(new DefinitelyNotSomething().dontdoit()); System.out.println(new Something().getRandomNumber()); } private static class Something { int x = 4; public Something() { System.out.println ("something"); } public void SomethingElse() { System.out.println ("something else"); } public void doit() { x++; System.out.println (x); x--; } public int dontdoit() { x++; x--; return x; } public int dodoitanddontdoit() { doit(); return dontdoit(); } public static void yay(int n) { if(n<=0) { return; } System.out.println ("Yay! I can push :D"); yay(n-1); } public static int getRandomNumber() { return 4; } } private static class DefinitelyNotSomething extends Something { int y = 3; public DefinitelyNotSomething() { super(); } public void doSomething() { System.out.println("Did Something."); } @Override public void SomethingElse() { System.out.println("Did Something Else."); } } static void hello() { System.out.println ("Hello World!"); System.out.println ("Greetings Mars!"); System.out.println ("I am not so cool!"); System.out.println ("But I am!"); System.out.println ("orly?"); System.out.println ("yarly?"); System.out.println ("Slow and fuzzy"); System.out.println ("I'll repeat the original question"); try { Thread.sleep(1); } catch (InterruptedException ie) { /* Ignore short sleep. */ } System.out.println ("Are you now or have you ever been"); System.out.println ("a member of the common ass party"); System.out.println ("or any other common ass organization?"); System.out.println ("Do I still have push access - yes - yippee"); } } // Push changes to testrepo. - Raoul