there are two classes in a java file, one is that the main class public class lab01_04, contains main functions, and the other is that if class a, does not call methods in class an in main, class a will not execute (methods in class a will not be executed either). Why is that?
attach code
package lab01;
import java.util.Scanner;
public class lab01_04 {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println(":");
double first=sc.nextDouble();
System.out.println(":");
double second =sc.nextDouble();
sc.close();
double hypotenuse = getHypotenuse(first,second);
hypotenuse = Math.round(hypotenuse*100)/100.0;
System.out.println(":"+hypotenuse);
}
public static double getHypotenuse(double a,double b) {
double sum = Math.pow(a, 2)+Math.pow(b, 2);
return Math.sqrt(sum);
}
}
class a{
private double j=6.0;
private double k=7.0;
double first=lab01_04.getHypotenuse(j,k);
public void b(){
System.out.println(":"+first);
}
}