How to access internal Method?

Public class Main { Associate T = new Associate(); public static void main(String[] args) { } void go(){ T.AmountPerHour(); T.TimeAndaHalf(); T.sumofPay(); } } /*ok how do i access my go method from my main method someone please help me*/

  • Answer:

    public class Main { Associate T = new Associate(); public static void main(String[] args) { } void go() { T.amountPerHour(); T.TimeAndaHalf(); T.sumofPay(); } } To access the go method, you've got some choices: 1) set both go and the member variable as static. 2) instantiate a new Main object within the main, and call the go method from that new object. Both will work, but which is correct kind of depends what the situation is.

Anonymous at Answerbag.com Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.