Java Tutorial

by Dinesh Thakur Category: Java Language

Java Tokens:- A java Program is made up of Classes and Methods and in the Methods are the Container of the various Statements And a Statement is made up of Variables, Constants, operators etc . 



 
by Dinesh Thakur Category: Java Language

Java Literals: A literal in java refers to a fixed value that appears directly in a program. Java define five primary types of literals. By literal we mean any number, text, or other information that represents a value. This means what you type is what you get. They are commonly known as constants. We will use literals in addition to variables in Java statement.



 
by Dinesh Thakur Category: Java Language

Type Casting: The process of converting one data type to another is called casting. Casting is often necessary when a function returns a data of type in different form then we need to perform an operation. Under certain circumstances Type conversion can be carried out automatically, in other cases it must be "forced" manually (explicitly). For example, the read() member function of the standard input stream (System.in) returns an int. If we want to store data of type int returned by read() into a variable of char type, we need to cast it :



 
by Dinesh Thakur Category: Java Language

In computer science, “type casting” and “type conversion” refers when there is either implicitly or explicitly is a conversion from one data type to another. When both types of expression are compatible with each other, then Data type conversions from one type to another can be carried out Automatically by java compiler. However, there is a technical difference between type conversion and type casting, i.e. type conversion is carried out “automatically” by java compiler while the "type casting" (using a cast operator) is to be explicitly performed by the java programmer.It is usually classified into two categories



 
by Dinesh Thakur Category: Java Language

Java Program Structure: A Java program consists of different sections. Some of them are mandatory but some are optional. The optional section can be excluded from the program depending upon the requirements of the programmer.

 
by Dinesh Thakur Category: Java Language

Java is a robust, general-purpose, high-level programming language and a powerful software platform. It is also object-oriented, distributed, portable and multi-threaded. Java follows the 'Write - once - run - anywhere' approach. All Java programs must run on the Java platform that has two components, the Java Virtual Machine (JVM) and the Java Application Programming Interface (API).

 
by Dinesh Thakur Category: Java Language

Keywords also are known as reserved words are the pre-defined identifiers reserved by Java for a specific purpose that inform the compiler about what the program should do. A Keyword is that which have a special meaning those already explained to the java language like int, float, class, public, etc. these are the reserved keywords. These special words cannot be used as class names, variables, or method names, because they have special meaning within the language.



 
by Dinesh Thakur Category: Java Language

Identifiers in Java. A Java identifier is the symbolic name that is used for identification purpose. In Java, an identifier can be a variable name, constant name, method name, class name, array name, packages name or an interface. Few authors term variables as an identifier. For example : int score = 100;

 
by Dinesh Thakur Category: Java Language

New is a Keyword Which is used when we are Creating an object of class For Storing all the data like variables and member functions  of class  there is some memory Space that is to be needed So that With the help of new Keyword and Object is Instantiated or Simply an object Reserves

 
by Dinesh Thakur Category: Java Language

Keywords are the words. Those have specifics meaning in the compiler.

 
by Dinesh Thakur Category: Java Language

There are times when you want to prevent inheritance. Perhaps there is no need the extensibility for various reasons. If you know this for sure, there are advantages to declaring the final keyword precisely that.

Java has a special keyword called final that can use for creating final methods, final classes, and final variables. The final modifier is void, which simply means that no value is returned.The final modifier indicates that the value of this member cannot change. We get a compile-time error if our program tries to change its contents. Each of these is explained in more detail next.

 
by Dinesh Thakur Category: Java Language

It is better to have all numerical, strings and characters in terms of objects so to avail the facility of methods supplied with those objects. In that case, even if we want to perform any arithmetical operation, we do it with the help of methods instead of using arithmetical operators. But by this approach, performance decreases because method calls are relatively expensive.

 
by Dinesh Thakur Category: Java Language

Bytecode: The intermediate code produced by certain semi-compiled programming languages, in particular SMALLTALK and JAVA, So called because each instruction is one byte long. Source programs are com piled into bytecode, which is then executed by a bytecode INTERPRETER or VIRTUAL MACHINE that forms part of the language RUN-TIME SYSTEM. In such languages, programs may be distributed either in SOURCE CODE or in bytecode form.

 
by Dinesh Thakur Category: Java Language

When you create new projects, you should see that there is quite a lot of text that is greyed-out and contains slashes and asterisks. These are called comments and,  when you run your program, the compiler will ignore them. Comments are usually nonexecutable statements which are meant for the programmers own convenience.

A comment is usually an explanation regarding the statement. Programmers use comments to allow readers of their code to understand better the code and how it works. Comments consist of English phrases that describe the purpose of the program, the use of identifiers, and the purpose of each program step. It also makes it easier to see where an error might show up. 

 
by Dinesh Thakur Category: Java Language

A very popular WEB SERVER developed and distributed free of charge as OPEN SOURCE software by an Internet-based community of unpaid volunteers. Apache's great strengths lie in the availability of its source code and its well-defined interface for writing add-on modules: many large and profitable e-commerce sites run on modified versions of Apache. The name is a wince-making pun on the phrase 'a patchy server', bestowed because of the numerous software PATCHES released for it in its early days.

 
by Dinesh Thakur Category: Introduction to Java

Java is the object oriented, similar to C++ high-level programming language and architecture neutral developed by Sun Microsystems. Java was originally called OAK. Object Oriented meaning the capability to reuse code. Secondly, it is platform independent i.e. we don't have to develop separate applications for different platforms. It is possible to develop a single application which can run on multiple platforms like Windows, UNIX, and Macintosh systems. Java was designed for hand-held devices and set-top boxes.

 
by Dinesh Thakur Category: Introduction to Java

The different languages reflect the different styles of programming. OOP or object-oriented programming is a style of programming with a firm basis in several concepts. Those concepts revolve around objects and classes and include Polymorphism, Encapsulation, Inheritance, Abstraction and more.  Java is one of the most popular of all the object-oriented programming languages, as well as one of the easiest to learn and use.   
Any application built on objects in Java is an object-oriented application and is based on the declaration of one or more classes, with an object created from those classes and the interaction between the objects.    

 
by Dinesh Thakur Category: Introduction to Java

Defination : The objects, are the building blocks of the object oriented programming language. In some situations, a programer may use multiple objects belonging to different classes which may have some kind of relationship among themselves as they share some common features.

Let us consider an example of a program containing objects of two different classes Car and Motorcycle for maintaining car and motor cycle information respectively. Both Car and Motorcycle classes exhibit some kind of relationship as both are a kind of vehicle and share some common features like speed, engine specification etc. To represent relationship between classes, we use the concept of Inheritance.



 
by Dinesh Thakur Category: Introduction to Java

Initializing a variable is considered very helpful while making programs. We can initialize variables of primitive types at the time of their declarations. For example:

int a =10;

In Object Oriented Programming language (OOPL) like Java, the need of initialization of fields of a new object is even more common. We have already done this using two approaches.

 
by Dinesh Thakur Category: Introduction to Java

The RMI architecture, shown in Figure, describes how remote objects behave and how parameters are passed between remote methods. Remote method invocation allows the program to define separately the behaviour and the code that implements the behaviour and allows running them on separate JVMs. This principle facilitates the clients to focus on the definition of a service while the servers can focus on providing the service.

 

Page 1 of 40



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.