Thursday, October 25, 2007

Java Interview Questions -Part 2


Question Can there be an abstract class with no abstract methods in it? (CoreJava)
Answer Yes

Question Can an Interface be final? (CoreJava)
Answer No

Question Can an Interface have an inner class? (CoreJava)
Answer Yes public interface abc { static int i=0; void dd(); class a1 { a1() { int j; System.out.println("in interfia"); }; public static void main(String a1[]) { System.out.println("in interfia"); } } }

Question Can we define private and protected modifiers for variables in interfaces? (CoreJava)
Answer No

Question What is the query used to display all tables names in SQL Server (Query analyzer)? (JDBC)
Answer select * from information_schema.tables

Question What is Externalizable? (CoreJava)
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 What modifiers are allowed for methods in an Interface? (CoreJava)
Answer Only public and abstract modifiers are allowed for methods in interfaces.

Question What is a local, member and a class variable? (CoreJava)
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 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 Can we implement an interface in a JSP? (JSP)
Answer No

Question What is the difference between ServletContext and PageContext? (JSP)
Answer ServletContext: Gives the information about the container
PageContext: Gives the information about the Request

0 comments:

Advertisement

 

Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com