Having issues in JAVA. I have the following statements: public class Faculty { p
ID: 664931 • Letter: H
Question
Having issues in JAVA.
I have the following statements:
public class Faculty
{
private static final String[] researchArea1 = new String[3];
private Staff departments;
private Zeller birthday;
private Person countryOfBirth;
private Person name;
private Employee EmployeeID;
private Employee yearsOfService;
public static String[] researchArea1()
{
String[] researchArea1 = new String[3];
researchArea1[0] = "physics";
researchArea1[1] = "math";
researchArea1[2] = "compsci";
for (String str : researchArea1) {
System.out.println(str);
}
return researchArea1;
}
I just want to print them by how i choose so if i do print researcharea1[2] i want "compsci" to print. Though I'm getting so many issues with this. Can someone help me right a print method for this?
Also--- is there a way to check say if someone entered " english"
to throw a null or a print statement that says "wrong department"?
Thanks!
Explanation / Answer
public class Faculty
{
private static final String[] researchArea1 = new String[3];
private String Staffdepartments;
private String Zellerbirthday;
private String PersoncountryOfBirth;
private String Personname;
private String EmployeeEmployeeID;
private String EmployeeyearsOfService;
public static String[] researchArea1()
{
String[] researchArea1 = new String[3];
researchArea1[0] = "physics";
researchArea1[1] = "math";
researchArea1[2] = "compsci";
for (String str : researchArea1) {
System.out.println(str);
if(str !=researchArea1[1] || str !=researchArea1[2] || str != researchArea[3]){
System.out.println("Enter wrong input");
}
return researchArea1;
}
}
public static void main(String args[]){
Faculty f= new Faculty();
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.