Java standard out produces no output -


i'm having trouble. code doesn't raise compile-time errors, system.out.println not displaying. should display how should color 4 sides. making mistake in loop or structure?

see code below:

public interface colorable {     // abstract called later     public abstract string howtocolor();  }  public class howtocolour {      /**      * @param args      *            command line arguments      */     public static void main(string[] args) {         // todo code application logic here     } }  public class testcolorable {     public static void main(string[] args) {         object[] obj1 = {              new square(),              new rectangle(),              new rhombus(),             new parallelogram(),              new trapezium()          };         (int = 0; < obj1.length; i++) {             if (obj1[i] instanceof colorable) {                 system.out.println(((colorable) obj1[i]).howtocolor());             } else {                 system.out.println("this shape not colored");              }         }     } }  class geometricogject {  }  // initial method use interface class square extends geometricogject implements colorable {     @override     public string howtocolor() {         return "square: color 4 sides";     } }  // method use interface in abstract class abstract class foursides implements colorable {  }  class rectangle extends foursides {     @override     public string howtocolor() {         return "rectangle: color 4 sides";     } }  class rhombus extends foursides {     @override     public string howtocolor() {         return "rhombus: color 4 sides";     } }  class parallelogram extends foursides {     @override     public string howtocolor() {         return "parallelogram: color sides";     } }  class trapezium extends foursides {     @override     public string howtocolor() {         return "trapezium: color 4 sides";     } } 

if in 1 file can see there potential conflict declaration of 2 classes having main function. coincidentally 1 of mains empty , 1 being executed. if these in different files should able execute on command line:

java testcolorable 

what presume happening, equivalent of:

java howtocolour 

do following, each in own file:

public class howtocolour   {       //implementation  }      public class testcolorable   {      //implementation }    javac testcolorable.java   javac howtocolour.java    java testcolorable      **output go here** java howtocolour      **no output here** 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -