Results 1 to 2 of 2

Thread: java

  1. #1
    dessireyy1 is offline Member
    Join Date
    Apr 2014
    Posts
    1
    Rep Power
    0

    Default java

    this is my program error occured run time,but compile sucessfully
    plzz help me..
    {error msg-Error: Main method not found in class helloworldapp.HelloWorldApp, please define the main method as:
    public static void main(String[] args)}


    class HelloWorldApp
    {
    private int empno;
    private float salary;
    void setHelloWorldApp()
    {
    empno=12;
    salary=1200;
    }
    void printHelloWorldApp()
    {
    System.out.println(empno);
    System.out.println(salary);
    }
    }
    class Payroll
    {
    public static void main(String[] args)
    {
    HelloWorldApp e1=new HelloWorldApp();
    HelloWorldApp e2=new HelloWorldApp();
    e1.setHelloWorldApp();
    e2.setHelloWorldApp();
    }
    }
    Last edited by dessireyy1; 04-26-2014 at 10:46 AM.

  2. #2
    kneitzel is offline Senior Member
    Join Date
    Feb 2014
    Posts
    447
    Rep Power
    1

    Default Re: java

    Can you give details what you are doing exactly?

    Maybe you try to tell java to start the application with the class HelloWorldApp. But your main method is in Payroll so have to start the application with the Payroll class.

    Konrad

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •