0
import java.io.*;
import java.util.*;
public class CompanyDetail {
int Id;
String name;
String department;
static String companyname="Maruti Suzuki";
CompanyDetail(int ID,String Name,String Dept) {
Id=ID;
name=Name;
department=Dept;
}
public void getdata() {
try {
InputStreamReader in = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(in);
System.out.println("Employee Id :");
Id = Integer.parseInt(br.readLine());
System.out.println("Employee name :");
name= br.readLine();
System.out.println("Employee Department :");
department=br.readLine();
System.out.println("Company is :"+companyname);
}
catch(Exception e) {
}
}
public void printdata() {
System.out.println("Employee Id is :"+Id);
System.out.println("Employee Name is :"+name);
System.out.println("Employee Department is :"+department);
System.out.println("Company is :"+companyname);
}
}
public class CompanyUse {
public static void main(String[] args) {
CompanyDetail cd = new CompanyDetail(int Id,String name,String department);
cd.getdata();
cd.printdata();
}
}
我得到錯誤的主要功能塊,當我創建一個object..eclips一直teeling我,構造CompanyDetail()是未定義....,沒有它的構造函數給我一個空值在我的output..please幫助我..我剛剛開始學習java ...非常感謝你提前:) :)構造CompanyDetail()是不確定的(JAVA)