Basic Structure and Fundamentals of Java.

In this article, What are Basic Structure and Fundamentals of Java? is explained in detail.We will learn about the basic structure of Java program.This structure consists of
  • Documentation Section.
  • Package Statements.
  • Class Definitions.
  • Class with main() method definition.
Documentation Section
In this section we write description or information about the program.It is done in two ways.
  •  //Single -line comment
  • /*......<<Multi line comment>>......*/
Ex: 
Single line comment: // program to add two numbers.
Multi-line comment              (From the Topic What are Basic Structure and Fundamentals of Java?)
/*
Java program to add two numbers.
Author:Java form admin.
Date created:13 sep, 2016.
Date modified:14 sep,2016.
company:Java form.
*/
Advantage
Comment in documentation section provides reference to the person who is reading your program.

Package Statements
This section allows the user to work with library files in a java program i.e., library classes and library methods.
This section is used in two ways.  (From the Topic What are Basic Structure and Fundamentals of Java?)
  • Importing packages.
  • Creating packages.
Importing packages
Ex: import java.util.*;
       import java.io.*;
The above statements are same as that of "#include<stdio.h>" in c and c++.

Note:By default, all the Java programs are provided with "java.lang" package automatically this package contains "String class","System class".
Creating a package
This section allows us to create a new package in a java program.
Ex:package<<pkg-name>>;

Class Definitions           (From the Topic What are Basic Structure and Fundamentals of Java?)
This section allows the user to define new classes in a program according to the requirement.
Ex:
1.class student                         
   {---
    --------
    }

2.class A
  {---
   ----
   }

Class with main() method definition
In a java program, we write a single class which contains the main method.This class is used for execution when we run our program using the class name.
Ex: 
class sample
{
public static void main(String args[])
{----
-----
-----
}
}
Fundamentals of Java
In this article, we will know about the fundamentals of Java,This include
  • Java character set.
  • Java tokens.
  • Data types.
Java character set
Different characters which are used in writing a java program is represented by character set.
We have four types of character sets.
  • Letters.
  • Digits.
  • Special characters.
  • White spaces.
Letters: They include English alphabets both uppercase and lower case.
Ex: a-z, A-Z.
Java is case-sensitive language.
Digits: This includes all numeric digits.
Ex:0 to 9.
Special characters: These are used for a special purpose under special situations in a java program.
White Spaces: These characters represents different types of spaces used in a Java program especially for printing purpose.   (From the Topic What are Basic Structure and Fundamentals of Java?)
\b-1 space back.
\t- horizontal space (5 spaces).
\v- vertical tab (This is not applicable to java).
\r- carriage return(takes cursor to begin).
\f- form feed(takes the cursor to next page,applicable for the printer, not for monitor devices).
\n- new line.

Continue to next topic Fundamentals of java and Java tokens.

Begin your career in Digital Marketing,What is digital marketing? Digital Marketing online course. It's an current evolving technology which can give support to establish your own startup through Digital Marketing.

                   Do check my new startup Surprise Planners in HyderabadLavish Surprises

Hi Friends, Please comment down your views in the comment section below, thank you...

No comments:

Connect with Us by Subscribing here for more Updates..!

* indicates required