Software Engineering related Java questions

1: What is the three tier model?

Ans: It is the presentation, logic, backend


2: Why do we have index table in the database?

Ans: 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.


3: Give an example of using JDBC access the database.

Ans:
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);

}



4: What is the different of an Applet and a Java Application

Ans: The applet doesn’t have the main function


5: How do we pass a reference parameter to a function in Java?


Ans: 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.


courtesy:http://www.crackthecampus.com

No comments:

Post a Comment