Skip to main content

Java J2EE Interview Questions and Answers - Part 2

  1. What is Garbage Collection and how to call it explicitly?- When an object is no longer referred to by any variable, java automatically reclaims memory used by that object. This is known as garbage collection. System. gc() method may be used to call it explicitly.
  2. What is finalize() method?- finalize () method is used just before an object is destroyed and can be called just prior to garbage collection.
  3. What are Transient and Volatile Modifiers?- Transient: The transient modifier applies to variables only and it is not stored as part of its object’s Persistent state. Transient variables are not serialized. Volatile: Volatile modifier applies to variables only and it tells the compiler that the variable modified by volatile can be changed unexpectedly by other parts of the program.
  1. What is method overloading and method overriding?- Method overloading: When a method in a class having the same method name with different arguments is said to be method overloading. Method overriding : When a method in a class having the same method name with same arguments is said to be method overriding.
  2. What is difference between overloading and overriding?- a) In overloading, there is a relationship between methods available in the same class whereas in overriding, there is relationship between a superclass method and subclass method. b) Overloading does not block inheritance from the superclass whereas overriding blocks inheritance from the superclass. c) In overloading, separate methods share the same name whereas in overriding, subclass method replaces the superclass. d) Overloading must have different method signatures whereas overriding must have same signature.
  3. What is meant by Inheritance and what are its advantages?- Inheritance is the process of inheriting all the features from a class. The advantages of inheritance are reusability of code and accessibility of variables and methods of the super class by subclasses.
  1. What is the difference between this() and super()?- this() can be used to invoke a constructor of the same class whereas super() can be used to invoke a super class constructor.
  2. What is the difference between superclass and subclass?- A super class is a class that is inherited whereas sub class is a class that does the inheriting.
  3. What modifiers may be used with top-level class?- public, abstract and final can be used for top-level class.
  1. What are inner class and anonymous class?- Inner class : classes defined in other classes, including those defined in methods are called inner classes. An inner class can have any accessibility including private. Anonymous class : Anonymous class is a class defined inside a method without a name and is instantiated and declared in the same place and cannot have explicit constructors.
  2. What is a package?- A package is a collection of classes and interfaces that provides a high-level layer of access protection and name space management.
  3. What is a reflection package?- java. lang. reflect package has the ability to analyze itself in runtime.
  1. What is interface and its use?- Interface is similar to a class which may contain method’s signature only but not bodies and it is a formal set of method and constant declarations that must be defined by the class that implements it. Interfaces are useful for: a)Declaring methods that one or more classes are expected to implement b)Capturing similarities between unrelated classes without forcing a class relationship. c)Determining an object’s programming interface without revealing the actual body of the class.
  2. What is an abstract class?- An abstract class is a class designed with implementation gaps for subclasses to fill in and is deliberately incomplete.
  3. What is the difference between Integer and int?- a) Integer is a class defined in the java. lang package, whereas int is a primitive data type defined in the Java language itself. Java does not automatically convert from one to the other. b) Integer can be used as an argument for a method that requires an object, whereas int can be used for calculations.

Comments

Popular Posts

DOT NET Interview Questions with Answers

When not to use Design Patterns?Do not use design patterns in any of the following situations.• When the software being designed would not change with time.• When the requirements of the source code of the application are unique.If any of the above applies in the current software design, there is no need to apply design patterns in the current design and increase unnecessary complexity in the design.When to use Design Patterns?Design Patterns are particularly useful in one of the following scenarios.• When the software application would change in due course of time.• When the application contains source code that involves object creation and event notification.Benefits of Design Patterns:The following are some of the major advantages of using Design Patterns in software development.• Flexibility• Adaptability to change• ReusabilityWhat are Design Patterns?A Design Pattern essentially consists of a problem in a software design and a solution to the same. In Design Patterns each pattern…

Job Posting - Assistant Managers / Deputy Managers / Managers for Designs.

Dear Colleagues,Our present employees are considered as a very important recruitment base and for some positions they are even the primary source of recruitment.We are looking for Assistant Managers / Deputy Manager / Managers for Designs division, to be based at Chennai / Hyderabad / Mumbai. The incumbent should be a self motivated and self driven team leader who can lead a team of engineers and draughtsmen. The job involves design of Cement Plant and allied structures for Indian and International clients.Interested candidates may apply by e-mail to SRRS-IN@flsmidth.com (for openings in Mumbai and Chennai) and to KKB-IN@flsmidth.com (for openings in Hyderabad) with their detailed CV on or before 10 Feb 2010.The details of the openings are as follows :PositionAssistant Managers / Deputy Managers / ManagersDepartmentDesignsJob ResponsibilityAllocating designs / drafting to juniors / draughtsmenProviding necessary inputs to enable them to do the allocated work.Checking of desi…

Walk-in interview on 27th March'10 in Bangalore @ TCS

Use this link, if unable to view the page Tata Consultancy Services (TCS) has endeavoured to help clients solve business challenges across diverse platforms and practices spread across multiple geographies. We, at TCS, offer you an opportunity to be a part of this dynamic team environment that is fulfilling, both professionally and personally.• "Industry Excellence Award 2008" (Institution of Engineers, India)
• "5-Year Multi-Million Dollar Deal" as ArvinMeritor's Global Engineering Partner
• "Best Use of Technology in Recruitment" (Recruiting and Staffing Best in Class -
     RASBIC Awards : 2009-2010)
Web Technologies

JAVA
– JAVA development experience

Microsoft Technologies (MS)

MOSS

.Net Designers
– Microsoft .Net, Oracle, IBM MQ
– Technical design experience
– Multi-engine/multithreading concepts
– Windows service experience

Business Intelligence / Knowledge Management (BI-KM)

Informatica Designer / Developer
– Informatica design / development experience

F…

.Net Framework Interview questions with answers

What do you know about BCL?The BCL (Base Class Library) is a combination of classes or we can say that it’s a library of functionalities and types available to all languages that used in .NET Framework. To make the programmer job more easier dot net gave a advantage to includes the BCL in order to collect a large number of common functions, just like to read a file and write to file, graphic rendering, database interaction, and XML document manipulation at one place . The scope of this is large and standard libraries for most other languages, including C++, and would be comparable in scope to the standard libraries is just like Java. The BCL is sometimes incorrectly referred to as the Framework Class Library (FCL), which is a superset including the Microsoft namespaces.In Assembly which work as GacBrowser ?The GACPicker class allows the user to select an assembly from the Global Assembly Cache. It does this by looking at the filesystem representation of the GAC, since there appears to…

ASP.NET 3.5 interview questions with answers

The IHttpHandler and IHttpHandlerFactory interfaces ?The IHttpHandler interface is implemented by all the handlers. The interface consists of one property called IsReusable. The IsReusable property gets a value indicating whether another request can use the IHttpHandler instance. The method ProcessRequest() allows you to process the current request. This is the core place where all your code goes. This method receives a parameter of type HttpContext using which you can access the intrinsic objects such as Request and Response. The IHttpHandlerFactory interface consists of two methods - GetHandler and ReleaseHandler. The GetHandler() method instantiates the required HTTP handler based on some condition and returns it back to ASP.NET. The ReleaseHandler() method allows the factory to reuse an existing handler.Does .NET CLR and SQL SERVER run in different process?Dot Net CLR and all .net realtes application and Sql Server run in same process or we can say that that on the same address be…

Wipro Infotech Walk-in for Freshers: Oct 31

Freshers IT Job Opening at Wipro InfotechExperience: 0 - 1 Years

Location: Pune

Education:
UG - Any Graduate - Any Specialization  
PG - Any PG Course - Any Specialization

Industry Type: IT-Hardware & Networking

Functional Area: IT-Support, Telecom, Hardware
Job Description:
Walk-in on 31st October at  Wipro Limited 5th Floor, C-Wing, Godrej Eternia, Old Pune - Mumbai Road, Near Shopper's Stop, Shivajinagar, Pune

Timings- 10:00am - 4:00pm



Contact person - Deepa Raman

Wipro is looking for candidates with 6 months to 1 year experience who can join immediately. The role will be on direct contract with Wipro.



Skills Required -
* Good communication & grammatical skills
* Basic understanding of networking terminologies
* Knowledge of workflow management tools like Clarify and Remedy would be desired
* Candidate should be willing to work in a 24/7 shift


Desired Candidate Profile
Walk-in on 31st October at Wipro Limited 5th Floor, C-Wing, G…

Contact Form

Name

Email *

Message *