Why can't you miss static?

xiaoxiao2021-03-06  39

? Public class TestSalary {public static void main (String [] args) throws IOException {System.out.println ( "Please Enter a number"); InputStreamReader reader = new InputStreamReader (System.in); BufferedReader input = new BufferedReader (reader String text = INPUT.READLINE (); integer x = new integer (); int s = x.intValue (); system.out.println ("the result is" raisserry (s));} public int INT Raisesalary (int S) / / There is no static {s * = 3; Return S;}} My understanding is: System.out.println ("The Result IS" RaisSalary (S)); RaisSalary ( s) No object call? 1. If your RaisSalary () method is not set to static, you must instance the Testsalary class, then call RaisSalary (). If you are defined as static, there is no such problem. 2. Method or variables that need to be called directly in the Static method should be defined as static. If you don't want to be defined as static, you should new testsalary (). RaisSalary (s)

转载请注明原文地址:https://www.9cbs.com/read-78063.html

New Post(0)