How to instantiate an object in java?

后端 未结 7 1088
不思量自难忘°
不思量自难忘° 2020-12-01 13:14

I\'m new in programming and I would like to know where did I go wrong in instantiating an object. Below is the code:

public class Testing{
    private int Sa         


        
7条回答
  •  余生分开走
    2020-12-01 13:50

    You instantiating correctly with new keyword ,But your calss name and method invoking is wrong

     Testing myTest = new Testing();
      int result =myTest.Sample(1);  //pass any integer value
      System.out.println(result );
    

提交回复
热议问题