Java Software Engineering Interview Questions

Question 1: What is the three tier model?
Answer: It is the presentation, logic, backend
Question 2: Why do we have index table in the database?
Answer: Because the index table contain the information of the other tables. It will
be faster if we access the index table to find out what the other contain.
Question 3: Give an example of using JDBC access the database.
Answer:
try
{
Class.forName("register the driver");
Connection con = DriverManager.getConnection("url of db", "username","password");
Statement state = con.createStatement();
state.executeUpdate("create table testing(firstname varchar(20), lastname varchar(20))");
state.executeQuery("insert into testing values(’phu’,'huynh’)");
state.close();
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
Question 4: What is the different of an Applet and a Java Application
Answer: The applet doesn’t have the main function
Question 5: How do we pass a reference parameter to a function in Java?
Answer: Even though Java doesn’t accept reference parameter, but we can
pass in the object for the parameter of the function.
For example in C++, we can do this:

void changeValue(int& a)
{
a++;
}
void main()
{
int b=2;
changeValue(b);
}

however in Java, we cannot do the same thing. So we can pass the
the int value into Integer object, and we pass this object into the
the function. And this function will change the object.