A Quick Referesher On JAVA

Why Java?

Java derives much of its character from C and C++. This is by intent. The Java designers knew that using the familiar syntax of C and echoing the object-oriented features of C++ would make their language appealing to the legions of
experienced C/C++ programmers. In addition to the surface similarities, Java shares some of the other attributes that helped make C and C++ successful. First, Java was designed, tested, and refined by real, working programmers. It is a language grounded in the needs and experiences of the people who devised it.

Thus, Java is also a programmer’s language. Second, Java is cohesive and logically consistent. Third, except for those constraints imposed by the Internet environment, Java gives you, the programmer, and full control. If you program well, your programs reflect it.

JAVA Interview Preparation

Question: 1 Can we define private and protected modifiers for variables in interfaces?(Core Java)

Answer: No.

Question: 2 What is the query used to display all tables names in SQL Server (Query
analyzer)? (JDBC)

Answer: select * from information_schema.tables

Question: 3 What is Externalizable? (Core Java)

Answer: Externalizable is an Interface that extends Serializable Interface. And sends
data into Streams in Compressed Format. It has two methods,
writeExternal(ObjectOuput out) and readExternal(ObjectInput in)

Question: 4 What modifiers are allowed for methods in an Interface? (Core Java)

Answer: Only public and abstract modifiers are allowed for methods in interfaces.

Question: 5 What is a local, member and a class variable? (Core Java)

Answer: Variables declared within a method are “local” variables. Variables declared
within the class i.e not within any methods are “member” variables (global variables).
Variables declared within the class i.e not within any methods and are defined as
“static” are class variables.

Question: 6 How many types of JDBC Drivers are present and what are they? (JDBC)

Answer: There are 4 types of JDBC Drivers

  • Type 1: JDBC-ODBC Bridge Driver
  • Type 2: Native API Partly Java Driver
  • Type 3: Network protocol Driver
  • Type 4: JDBC Net pure Java Driver

Question: 7 Can we implement an interface in a JSP? (JSP)

Answer: No

Question: 8 What is the difference between ServletContext and PageContext? (JSP)

Answer: ServletContext: Gives the information about the container PageContext: Gives
the information about the Request

Question:9 What is the difference in using request.getRequestDispatcher() and
context.getRequestDispatcher()? (JSP)

Answer: request.getRequestDispatcher(path): In order to create it we need to give the
relative path of the resource context.getRequestDispatcher(path): In order to create it
we need to give the absolute path of the resource.

Share to Unlock Contentimage/svg+xml
Unlock this exclusive content by using one of the sharing buttons below.