通过类名调用类方法 package demo; public class Text { double x,y; static double max(double a,double b) { return a>b?a:b; } public static void main(String[] args) { double max=Text.max(12.0,45.2); System.out.println(max); } } 45.2