public class Simple { public static void main(String[] args) { String str = "-12"; str += "34"; float val = Integer.parseInt(str + '5'); System.out.println("val = " + val); } }
public class Simple { public static void main(String[] args) { Integer num = new Integer(7 + 9); double dbl = num.doubleValue() / 2; System.out.println("dbl = " + dbl); } }
public class Simple { Simple() { value = (int) (value / 10); } public String toString() { return "" + value; } public static void main(String[] args) { Simple simple = null; for (int n = 0; n < 5; n++) simple = new Simple(); System.out.println(simple); } private static double value = 12345678; }
public class Simple { Simple() { value = 3; } void update(Simple s) { s.value *= s.value; } public String toString() { return "" + value; } public static void main(String[] args) { Simple s = new Simple(); Simple t = new Simple(); s.update(t); System.out.println(s + " " + t); } private short value; }
public class Blob { static int count = 0; Blob() { ++count; } public void report() { System.out.println(count+" Blobs"); } public static void main(String[] args) { int LIMIT = (int)(20*Math.random()); for (int n = 0; n < LIMIT; n++) new Blob(); Blob.report(); } }
public class Blob { static int count = 0; Blob() { ++count; } static void report() { System.out.println(count+" Blobs"); } public static void main(String[] args) { int LIMIT = (int)(20*Math.random()); for (int n = 0; n < LIMIT; n++) new Blob(); Blob.report(); } }
public class Blob { final int count = 0; Blob() { ++count; } static void report() { System.out.println(count+" Blobs"); } public static void main(String[] args) { int LIMIT = (int)(20*Math.random()); for (int n = 0; n < LIMIT; n++) new Blob(); Blob.report(); } }
public class Blob { int count = 0; Blob() { ++count; } static void report() { System.out.println(count+" Blobs"); } public static void main(String[] args) { int LIMIT = (int)(20*Math.random()); for (int n = 0; n < LIMIT; n++) new Blob(); Blob.report(); } }
public class Blob { Blob() { int LIMIT = (int)(20*Math.random()); Bleep bleep = null; for (int n = 0; n < LIMIT + 1; n++) bleep = new Bleep(); bleep.report(); } class Bleep { int count = 0; Bleep() { ++count; } public void report() { System.out.println(count + " Bleeps"); } } public static void main(String[] args) { new Blob(); } }
public class Blob { int count = 0; Blob() { int LIMIT = (int)(20*Math.random()); Bleep bleep = null; for (int n = 0; n < LIMIT + 1; n++) bleep = new Bleep(); bleep.report(); } class Bleep { Bleep() { ++count; } public void report() { System.out.println(count + " Bleeps"); } } public static void main(String[] args) { new Blob(); } }
public class Blob { int count = 0; Blob() { int LIMIT = (int)(20*Math.random()); Bleep bleep = null; for (int n = 0; n < LIMIT + 1; n++) new Bleep(); Bleep.report(); } class Bleep { Bleep() { ++count; } public void report() { System.out.println(count + " Bleeps"); } } public static void main(String[] args) { new Blob(); } }
public class Blob { int count = 0; Blob() { int LIMIT = (int)(20*Math.random()); Bleep bleep = null; for (int n = 0; n < LIMIT + 1; n++) new Bleep(); Bleep.report(); } class Bleep { Bleep() { ++count; } static void report() { System.out.println(count + " Bleeps"); } } public static void main(String[] args) { new Blob(); } }