0
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.

6
Contributors
7
Replies
9
Views
4 Years
Discussion Span
Last Post by Aditya_4
0

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)

Edited by mvmalderen

0

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

-1

if ur problem is solved then mark this thread solved pls

Votes + Comments
Proper English expected, there are no words such as ur or pls
0

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.

2

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.