class Emp
{
 int name, emp_no, addrs, ph_no, deprtmnt, post, project;
 Emp(int a, int b, int c, int d, int e, int f, int g)
 {
  name=a;
  emp_no=b;
  addrs=c;
  ph_no=d;
  deprtmnt=e;
  post=f;
  project=g;
 }
 Emp(int a, int b, int c, int d)
 {
  name=a;
  emp_no=b;
  addrs=c;
  ph_no=d;
 }
 Emp(int a, int b, int c, int e, int f)
 {
  name=a;
  emp_no=b;
  addrs=c;
  deprtmnt=e;
  post=f;
 }
 Emp(int a, int b, int c, int e, int f, int g)
 {
  name=a;
  emp_no=b;
  deprtmnt=e;
  post=f;
  project=g;
 }
 Emp()
 {
  System.out.println(name+","+emp_no+","+addrs+","+ph_no+","+deprtmnt+","+post+","+project);
 }
}

class Emp1
{
 public static Void Main(String[]args)
 {
  Emp obj1= new Emp(11,12,13,14,15,16,17);
  Emp obj2= new Emp(22,23,24,25);
  Emp obj3= new Emp(31,32,33,34,35);
  Emp obj4= new Emp(41,42,43,44,45,46);
  Emp obj5= new Emp();
 }// showing error
}

this is my basis program on constructor. when i compile it show error 'classname.java:52:missing return statement'. i don't know how to solve this error. i hava just started learning java.

Recommended Answers

All 7 Replies

Line 45 in the code you posted: public static Void Main(String[]args) correct it to:
public static void main(String[]args) (main without capital and void without capital)

(Even though it will compile with Main as identifier, it won't run because there's no main defined)

i also think the main problem is with Void Main() just write them in samll caps as java is case sensitive i hope it will be working fine then

if ur problem is solved then mark this thread solved pls

commented: Proper English expected, there are no words such as ur or pls -3

One problem is Void should be in smaller like void because it is cas sensitive.
Also there is space between array and variable name like (String[] args).

Hope you will get it.

There should be void main not Void Main.

OK guys, that's enough repeating each other's posts. Tux4life made it perfectly clear the first time. Please don't just re-post the same answer without adding any new information.

thanks for solving my problem.

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.