EARN 400$ PER WEEK

Custom Search

Saturday, December 4, 2010

Java Basics

  1. What is a platform?

A platform is the hardware or software environment in which a program runs. Most platforms can be described as a combination of the operating system and hardware, like Windows 2000/XP, Linux, Solaris.

  1. What is the main difference between Java platform and other platforms?

The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other hardware-based platforms.

The Java platform has two components:

    1. The Java Virtual Machine (Java VM)
    2. The Java Application Programming Interface (Java API)

  1. What is the Java Virtual Machine?

The Java Virtual Machine is software that can be ported onto various hardware-based platforms


  1. What is the Java API?

The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface widgets.

  1. What is the package?

The package is a Java name-space or part of Java libraries. The Java API is grouped into libraries of related classes and interfaces; these libraries are known as packages.

  1. What is native code?

The native code is code that after you compile it, the compiled code runs on a specific hardware platform.

What is the difference between an Interface and an Abstract class? An Abstract class declares have at least one instance method that is declared abstract which will be implemented by the subclasses. 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.

7. What is the purpose of garbage collection in Java, and when is it used?

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.

8. What is the serialization?

The serialization is a kind of mechanism that makes a class or bean persistent by having its properties or fields and state information saved and restored to and from storage.

9. What is a transient variable?

A transient variable is a variable that may not be serialized. If you don't want some field to be serialized, you can mark that field transient or static

10. Which class is the super class for every class?

Object

11. What is thread?

A thread is an independent path of execution in a system.

12. What is multithreading?

Multithreading means various threads that run in a system.

13. How does multithreading take place on a computer with a single CPU?

The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.

14. How to create multithread in a program?

You have two ways to do so. First, making your class "extends" Thread class. Second, making your class "implements" Runnable interface. Put jobs in a run () method and call start () method to start the thread.

15. Can Java object be locked down for exclusive use by a given thread?

Yes. You can lock an object by putting it in a "synchronized" block. The locked object is inaccessible to any thread other than the one that explicitly claimed it.

  1. What state does a thread enter when it terminates its processing?

When a thread terminates its processing, it enters the dead state.



  1. What invokes a thread's run () method?

After a thread is started, via its start () method of the Thread class, the JVM invokes the thread's run () method when the thread is initially executed.

  1. What is the purpose of the wait (), notify (), and notify All () methods?

The wait (), notify (), and notify All () methods are used to provide an efficient way for threads to communicate each other.

  1. What are the high-level thread states?

The high-level thread states are ready, running, waiting, and dead.

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

An Abstract class declares have at least one instance method that is declared abstract which will be implemented by the subclasses. 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.

7 comments:

Michelle C. said...

Thanks for the information on Java. design web applications are essential for creating good websites.

Movies Gallery 2011 said...

Beautiful tutorial...those are easy way to learn it. Lot of appreciation to you and i would like to introduce our site for Google android apps development and IPhone App Development just check it out.

Unknown said...

Great info on Java.keep updating.


Rize

ganesh said...



Wonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging!


Java Training Courses

Unknown said...

useful information.. Thanks for sharing.

Iphone application development in Delhi NCR

Unknown said...

very nice and useful post
Best Big Data Hadoop summer training
Best android summer training

Anonymous said...

Thanks for Sharing a Great Article.
Kvch Delhi provides 6 weeks big data hadoop internship companies in delhi is designed to give you in-depth knowledge of the Big Data framework using Hadoop and Spark, including HDFS, YARN, and MapReduce. You will learn to use Pig, Hive, and Impala to process and analyze large datasets stored in the HDFS, and use Sqoop and Flume for data ingestion with our big data training.
Best big data hadoop six weeks project based summer training in delhi
summer training in big data hadoop in Delhi