public class review{
        //method code
        public void start() {
        int a, b;
        a = 5;
        b = methodA(a);
        System.out.println(a + " " + b);
        }

           private int methodA(int a) {
           int b = 10;
           a = a + 5;
           return a + b;
           }
        //method end
    }  

------------------------------------------------
i compile and run this code in dr.java compiler jdk 6.0_41
it can compile, but when i run it will display like thi
"Static Error: This class does not have a static void main method accepting String[]"

when i try to add

public static void main (String[]args){
//method code
}

when i compile it will display

public void start() {

as an illegal start of expression.
it is something wrong with my dr.java compiler or i wrote wrong code?

hope anyone can help.
thanks in advanced

main is special since it has to be present to start the program, so it's required to have a fixed signature. Under the hood, the java runtime looks for the magic signature to start the program. The magic signature is

public static void main(String[] args)
So your code must look something like this

 public class review{
        //method code
    public void start() {
       //your start() method
        }

            private int methodA(int a) {
      //your methodA
       }
        public static void main (String[]args){
        //create object of review and call start() method using that object.eg:- review referenceVariable = new review();referenceVariable.start();
         }
    }  

though not related to the problem (which IIM solves above) , but , you should update your java version.
A lot of nasty things are roaming all over cyberspace , each new update helps in making the holes a bit smaller for them to enter your system through.

@somjit : nothing problem with the compiler bro.
@IIM : thanks lot, yah i forgot to put object.

the compiler will work fine. but it exposes you to a lot of stuff out there you wouldnt want your machine to be visited by.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.