Submitting in Java in SPOJ -


i tried submitting program many classes in java , spoj did not accept showing compilation errors . how submit multi class programs in java in spoj

you can submit multi class java programs spoj.

just define them inner classes of main class.

note inner class(es) not need static.

find below sscce (short, self contained, correct, example):

public class main {      static class 1 {         static int getvalue() {             return 1;         }     }      static class 2 {         static int getvalue() {             return 2;         }     }      static class calculator {         static void printresult() {             int sum = one.getvalue() + two.getvalue();             system.out.println("the sum " + sum + ".");         }     }      public static void main(string[] args) {         calculator.printresult();     }  } 

output: sum 3.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -