Import our own classes in java -


ok here deal: have "run" class runs main code. have class named "mathematics" has calculations in it. want import "mathematics" "run". how can that. have tried way:

import java.io.*; import java.*; import java.math.*; import mathematics;  public class run {     public static void main (string[] args){         system.out.println(power(4.0, 2));      }     public static double picalculator (double x){         return math.pi * x;     }     public static double power (double x, int y){         double z = 1;         (int n = 0; n < y; n++){             z = (z * x);         }         return z;     }  } 

so please tell me how can this. here pictures. complete code sample

no need import mathematics class. create object class mathematics , use it.

mathematics math = new mathematics(); 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -