Showing posts with label core java. Show all posts
Showing posts with label core java. Show all posts

Top 100 Java Questions

0 comments Posted by Unknown at 18:23


1. What is the diffrence between an Abstract class and Interface ?
2. What is user defined exception ?
3. What do you know about the garbate collector ?
4. What is the difference between C++ & Java ?
5. Explain RMI Architecture?
6. How do you communicate in between Applets & Servlets ?
7. What is the use of Servlets ?
8. What is JDBC? How do you connect to the Database ?
Read More »

java vs xml questions

0 comments Posted by Unknown at 18:15

PART-II

33. What is callback methods

Component methods called by the container to notify the component of important events in its life cycle.

 34. What is caller

Same as caller principal.

35. What is caller principal

The principal that identifies the invoker of the enterprise bean method.

36. What is cascade delete

A deletion that triggers another deletion. A cascade delete can be specified for an entity bean that has
container-managed persistence.

37. What is CDATA

A predefined XML tag for character data that means "don't interpret these characters," as opposed to
parsed character data (PCDATA), in which the normal rules
Read More »

Interview Questions in core Java

0 comments Posted by Unknown at 15:30
1) Q: What is the purpose of the toolkit in the Abstract Window Toolkit (AWT)? How does AWT
work ?
A: The AWT toolkit is an interface between the abstract window layer and a specific windowing
implementation.

2) Q: What is layout manager ? How does it work ?
A: A layout manager is an object that positions and resizes the components in a Container according to
some algorithm; for example, the FlowLayout layout manager lays out components from left to right until itruns out of room and then continues laying out components below that row.

3) Q: Advantages and disadvantages of layout manager ?
Read More »

Interview Questions in Core Java

0 comments Posted by Unknown at 15:10

PART -II

101. What is the purpose of the System class?
The purpose of the System class is to provide access to system resources.

102. Which TextComponent method is used to set a TextComponent to the read-only state?
setEditable()

103. How are the elements of a CardLayout organized?
The elements of a CardLayout are stacked, one on top of the other, like a deck of cards.

104. Is &&= a valid Java operator?
No, it is not.

105. Name the eight primitive Java types.
The eight primitive types are byte, char, short, int, long, float, double, and boolean.

106. Which class should you use to obtain design information about an object?
The Class class is used to obtain information about an object's design.
Read More »

Java Job Interview Questions-4

0 comments Posted by Unknown at 10:11

Part-4

1.     Explain the usage of Java packages.
This is a way to organize files when a project consists of multiple modules. It also helps resolve naming conflicts when different packages have classes with the same names. Packages access level also allows you to protect data from being used by the non-authorized classes.

2.     If a class is located in a package, what do you need to change in the OS environment to be able to use it?

You need to add a directory or a jar file that contains the package directories to the CLASSPATH environment variable. Let’s say a class Employee belongs to a package com.xyz.hr; and is located in the file c:/dev/com.xyz.hr.Employee.java. In this case, you’d need to add c:/dev to the variable CLASSPATH. If this class contains the method main(), you could test it from a command prompt window as follows:
c:\>java com.xyz.hr.Employee
Read More »

Java Job Inteview Questions -3

0 comments Posted by Unknown at 10:06
Part 3
How could Java classes direct program messages to the system console, but error messages,say to a file?


The class System has a variable out that represents the standard output, and the variable err that represents the standard error  device. By default, they both point at the system console. This how the standard
output could be re-directed:
Stream st =new Stream (new FileOutputStream ("techinterviews_com.txt"));
System.setErr(st);
System.setOut(st);
Read More »

Java Job Interview Questions-2

0 comments Posted by Unknown at 09:55

Part-2

What is the advantage of OOP?

You will get varying answers to this question depending on whom you ask. Major advantages of OOP are: 
1. Simplicity: software objects model real world objects, so the complexity is reduced and the program structure is very clear; 



2. Modularity: each object forms a separate entity whose internal workings are decoupled from other parts 

of the system; 

3. Modifiability: it is easy to make minor changes in the data representation or the procedures in an OO program. Changes inside a class do not affect any other part of a program, since the only public interface that the external world has to a class is through the use of methods; 

4. Extensibility: adding new features or responding to changing operating environments can be solved by introducing a few new objects and modifying some existing ones; 


5. Maintainability: objects can be maintained separately, making locating and fixing problems easier; 



6. Re-usability: objects can be reused in different programs


What are the main differences between Java and C++?
Everything is an object in Java( Single root hierarchy as everything gets derived from java.lang.Object). Java does not have all the complicated aspects of C++ ( For ex: Pointers, templates, unions, operator overloading, structures etc..)  The Java language promoters initially said "No pointers!", but when many programmers questioned how you can work without pointers, the promoters began saying "Restricted pointers." You can make up your mind whether it’s really a pointer or not. In any event, there’s no pointer arithmetic. There are no destructors in Java. (automatic garbage collection),  Java does not support conditional compile (#ifdef/#ifndef type). Thread support is built into java but not in C++. Java does not support default arguments. There’s no scope resolution operator :: in Java. Java uses the dot for everything, but can get away with it since you can define elements only within a class. Even the method definitions must always occur within a class, so there is no need for scope resolution there either. There’s no "goto " statement in Java. Java doesn’t provide multiple inheritance (MI), at least not in the same sense that C++ does. Exception handling in Java is different because there are no destructors. Java has method overloading, but no operator overloading. The String class does use the + and += operators to concatenate strings and String expressions use automatic type conversion, but that’s a special built-in case. Java is interpreted for the most part and hence platform independent

What are interfaces?

Interfaces provide more sophisticated ways to organize and control the objects in your system. 
The interface keyword takes the abstract concept one step further. You could think of it as a “pure” abstract class. It allows the creator to establish the form for a class: method names, argument lists, and return types, but no method bodies. An interface can also contain fields, but The interface keyword takes the abstract concept one step further. You could think of it as a “pure” abstract class. It allows the creator to establish the form for a class: method names, argument lists, and return types, but no method bodies. An interface can also contain fields, but an interface says: “This is what all classes that implement this particular interface will look like.” Thus, any code that uses a particular interface knows what methods might be called for that interface, and that’s all. So the interface is used to establish a “protocol” between classes. (Some object-oriented programming languages have a keyword called protocol to do the same thing.)  Typical example from "Thinking in Java":


Read More »

Java Job Interview Questions-1

0 comments Posted by Unknown at 09:46

Part-1

1. Can there be an abstract class with no abstract methods in it? - Yes
2. Can an Interface be final? - No
3. Can an Interface have an inner class? - Yes.
4. public interface abc
5. {
6. static int i=0; void dd();
7. class a1
8. {
9. a1()
10. {
11. int j;
12. System.out.println("inside");
13. };
14. public static void main(String a1[])
15. {
16. System.out.println("in interfia");
17. }
18. }
19. }

20. Can we define private and protected modifiers for variables in interfaces? - No

Read More »

Advanced Java Questions

0 comments Posted by Unknown at 09:30

Advanced Java Questions


Q1. All Object Oriented Languages share three common defining traits, explain these.

A1. Encapsulation, Polymorphism and Inheritance. 

Q2. What is the difference between a class and a structure? 

A2. In a class, members are private by default. In a structure, members are public by default. 

Q3. What is the difference between a class and an object.

A3. A class defines an Objects methods and instance variables, i.e. the data it will store and methods to access that data. An Object is an instantiated Class which has a state.
Read More »

J2EE interview question In LNT

1 comments Posted by Unknown at 15:44
Java – Fundamentals
Q 01: Give a few reasons for using Java? 
A 01: Java is a fun language. Let’s look at some of the reasons:
􀂃 Built-in support for multi-threading, socket communication, and memory management (automatic garbage collection).
􀂃 Object Oriented (OO).
􀂃 Better portability than other languages across operating systems.
􀂃 Supports Web based applications (Applet, Servlet, and JSP), distributed applications (sockets, RMI, EJB etc) and network protocols (HTTP, JRMP etc) with the help of extensive standardized APIs (Application Programming Interfaces).
Read More »

CORE JAVA INTERVIEW QUESTIONS AND ANSWERS

0 comments Posted by Unknown at 02:27


CORE JAVA INTERVIEW QUESTIONS AND ANSWERS 



What is the most important feature of Java? 
Java is a platform independent language. 

What do you mean by platform independence? 
Platform independence means that we can write and compile the java code in one platform (eg Windows) and can execute the class in any other supported platform eg (Linux,Solaris,etc). 

Are JVM's platform independent?
JVM's are not platform independent. JVM's are platform specific run time implementation provided by the vendor. 
Read More »

Mahindra Java Interview Questions With Answers-2:

0 comments Posted by Unknown at 02:24

Mahindra Java Interview Questions With Answers-2:
1) Explain about Core Java?
Java is increasingly used for middleware applications to communicate between Server and clients. Java has features such as multithreading, portability and networking capabilities. Changes in the java library made java as a favorite programming language for developers it added functionality to their scripts.

2) State some advantages of Java?
Platform independence is the key feature of Java during runtime. Syntax of java is similar to the popular object oriented languages such as C and C++. Java program can eliminate most of the bugs present in the program. Manual memory allocation and de allocation feature present in Java is automated.
Read More »

HCL JAVA INTERVIEW QUESTIONS AND ANSWERS

3 comments Posted by Unknown at 02:23

JAVA INTERVIEW QUESTIONS AND ANSWERS

What is the difference between an Interface and an Abstract class?

A:        An abstract class can have instance methods that implement a default behavior. An Interface can only declare constants and instance methods, but cannot implement default behavior and all methods are implicitly abstract. An interface has all public members and no implementation. An abstract class is a class which may have the usual flavors of class members (private, protected, etc.), but has some abstract methods.

Q:        What is the purpose of garbage collection in Java, and when is it used?

A:        The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused. A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used.
           
Read More »
 

© 2011. All Rights Reserved | Interview Questions | Template by Blogger Widgets

Home | About | Top ▲