Your preferences have been saved!
» Demotion of primitives and overloading - public class Demotion {   void f1(char x) {     System.out.println("f1(char)");   }   void f1(byte x) {     System.out.println("f1(byte)");   }   void f1(short x) {     System.out.println("f1(short)");   }... 17 Feb 12 » Overloading a base-class method name in a derived class does - class Homer {   char doh(char c) {     System.out.println("doh(char)");     return 'd';   }   float doh(float f) {     System.out.println("doh(float)");     return 1.0f;   } }... 17 Feb 12 » Promotion of primitives and overloading - public class PrimitiveOverloading {   void f1(char x) {     System.out.println("f1(char)");   }   void f1(byte x) {     System.out.println("f1(byte)");   }   void f1(short x) {     System.out.println("f1(short)");   }... 17 Feb 12 » Overloading based on the order of the arguments - public class OverloadingOrder {   static void print(String s, int i) {     System.out.println("String: " + s + ", int: " + i);   }   static void print(int i, String s) {     System.out.println("int: " + i + ", String: " + s);   }   public static void main(String[] args) {     print("String first", 11);     print(99, "Int first");... 17 Feb 12 » Demonstration of overriding fields - /** Demonstration of overriding fields. */ public class OverrideField {   public static void main(String[] av) {     System.out.println("OA's version of getAttr returns: " +       new OA().getAttr());     System.out.println("OB's version of getAttr returns: " +       new OB().getAttr());     // Declared as OA, instantiated as OB, so gets OB's version of things.     OA c = new OB();     System.out.println("C's version of getAttr returns: " +... 17 Feb 12 » Overloaded method - public class Overloading {   double method(int i) {     return i;   }   boolean method(boolean b) {     return !b;   }   static double method(int x, double y) {     return x + y + 1;   }... 17 Feb 12 » Overloaded constructor - public class Point {   int x, y;   Point(int x, int y) // Overloaded constructor   {     this.x = x;     this.y = y;   }   Point(Point p) // Overloaded constructor   {     this(p.x, p.y);... 17 Feb 12 » Demonstration of both constructor and ordinary method overloading - class Tree {   int height;   Tree() {     System.out.println("Planting a seedling");     height = 0;   }   Tree(int i) {     System.out.println("Creating new Tree that is " + i + " feet tall");     height = i;   }... 17 Feb 12