Sunday, February 17, 2013

5.Declaring Fields

Declaring Fields: 

Formatting Identifiers

In the Java programming language, an identifier is a name given to a variable, class, or method. Identifiers start with a letter, underscore (_), or dollar sign ($) and valid currency symbols. Subsequent characters can be digits. Identifiers are case-sensitive and have no maximum length.

The following are valid identifiers:
1. identifier
2. userName
3. user_name
4. _sys_var1
5. $change // Legal but not encouraged

 Initializing Fields

This section addresses the initial values allocated to the fields (attributes)
of a newly created object.

 string a="name";

Java technology provides the following mechanisms for field initialization.
● Initialize using default values
● Initialize using explicit values
● Initialize using constructors

Java Language Keywords

Here is a list of keywords in the Java programming language. You cannot use any of the following as identifiers in your programs. The keywords const and goto are reserved, even though they are not currently used. true,false, and null might seem like keywords, but they are actually literals; you cannot use them as identifiers in your programs.
* not used
** added in 1.2
*** added in 1.4
**** added in 5.0
 Source : 


4.Primitive Data Type Literals

 Data Type Literals

You should know this.

3.Creating a Simple Java Application

Creating a Simple Java Application

1. First you have to open your NetBeans IDE. Then create a new project like below.....
2. Now select Java >> Java Application


3. Now giva a name for your project.
4.  Now write a code into here.

 4. Now run your program.









5. Now see what you have done!  

Lets try something like this.

2.The Java Virtual Machine (JVM)

The Java Virtual Machine (JVM)

JVM implementations are platform specific. For example, to execute a Java application on a Solaris OS, you need the JVM implementation that is specific to the Solaris OS. Similarly, to execute a Java technology application on a Windows OS, you need the JVM implementation that is specific to the Windows OS. An application written using the Java programming language is platform independent. Such an application can run on any platform that contains a supporting JVM implementation.

The Class Loader

The class loader loads all classes needed for the execution of a program. The class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources. This limits any Trojan Horse applications, because local classes are always
loaded first. After all of the classes have been loaded, the memory layout of the
executable file is determined. At this point, specific memory addresses are assigned to symbolic references and the lookup table is created. Because memory layout occurs at runtime, the Java technology interpreter adds protection against unauthorized access into the restricted areas of code.

1. Introducing Java

Introducing Java

Java is a general-purpose, concurrent, class-based, object-oriented computer programming language that is specifically designed to have as few implementation dependencies as possible.Java is an innovative programming language that has become the language of choice for programs that need to run on a variety of different computer systems. First of all, Java enables us to write small programs called applets.Java allows us to write large-scale application programs that we can run unchanged on any computer with an operating system environment in which Java is supported. This applies to the majority of computers in use today. We can even write programs that will work both as ordinary applications and as applets.


The main goal of the Java™ Programming Language course is to provide you with the knowledge and skills necessary for object-oriented programming of advanced Java applications. In this course, you learn the Java programming language syntax and object-oriented concepts, as well as more sophisticated features of the Java runtime environment, such as support for GUIs, multithreading, and networking. This course covers prerequisite knowledge to help prepare you for the Sun Certified Programmer for the Java™ Platform (SCJP) examination. For information about the exam, review the web site:

What you need to Start Java Programming?  

First you need a JDK (Java Development Kit) Software. You can download from here.
Then you have to install it in you PC. You must be update with java. It will automatically update when you are connecting to internet.
Then you need a NetBeans IDE. Where you write your all java code to create a Software. You can download from here.  You can find here IDE for your suitable Operating System (Windows, Mac, Linux, etc).

Now you have to install these Software in you PC.