Why should we learn Java and at least how much I should know about Java

JAVA 

Java is high level object oriented programming language. It a programming language also it a platform and also technology, It is not a JavaScript, JavaScript is a object based language but java is pure object oriented language, And now java is using for all types of application developing.
Now it possible to developed many types if Application and Desktop Software/application with the using of java.
Also develop website and web application, mobile application.
Java is simple, secure and high level platform independent language which has capability to develop various types of application such as system software (OS and Compiler). Application software (Desktop, web, mobile, enterprise, embedded, database and testing application etc).



JAVA has only 1 drawback it not directs interact hardware.


Program: - Program is a set of instruction to achieve specific task.
               
JAVA IS
·       Simple
·       Secure
·       Platform independent
·       Portable
·       Robust
·       Open source
·       Object oriented
·       Architecture neutral
·       Multi thread
·       Distribute
·       Dynamic

 "JAVA"

NOOK AND CORNER

Today Java language is most very popular language in the programming field,It main reason Java is used in every nook and corner
Java is simple, secure and high level platform independent language which have capability to develop various types of application such as 
  • System software 
  • Application software
  • Utility software

Function

"Sub Routine Method"
Function is a set of statement which are user to perform a specific task.It provide reusable component into the program .It is also know as sub routine method.

There are five basic component of a function
1)    Name
2)    Task (   body )
3)    Header ((signature)  How to use ( return type, Name, Parameter))
4)    Location ((function ) (class) (package))
5)    Type of Function
There are two stages into life cycle of a function.
·        Function Definition: - define
·        Function Calling: - utilize

Syntax of Function definition

AccessSpecifier   modifier    ReturnType    name(parameter)
{
    //body
     return statement;
}


Access Specifies
           
            Public   private   protected   default.

Modifier
          
           Static, abstract,   final and more………

Return type

It a type of final result returns by the function. If the function does not return any value then
there return type will be void by default the return type is int.

Name
          
           It is the valid identifier which is use to recognize.

Parameter

Parameter are set of variable which are use to receive required value of called function.

Body

          It consists of set of statement which defines the functionality of the function.

Return statement
        
            It is use to terminate the executed of the function, it’s totally depend return type.
            If the return type of the function is void then it’s doesn’t need return statement because is
            automatically terminate
            At a time a function can only execute a single return statement  

The Java Foundation Classes "JFC" are a set of GUI component which simplify the development of desktop applications.

Does JVM create object of main class (the class with main())?


No, we have studies that the reason for main() static in java is to make sure the Main() can be called without any instance.

how java platform independent?


The meaning of platform independent is that the java source code can run an all operating system.
Java platform independent because JVM, JVM provided all adjustment in OS(all types),

Java is platform independent language but JVM is platform dependent 

Inheritance is as important characteristic of Object oriented programming by which we can define a new class from an extends class in such way that the new class will acquired all the public and protected properties of extends class.

The new class can also add there an properties, the extends class known as super class or parent class and the new class known as subclass and child class.

Inheritance provides the facility of code re-usability if you use inheritance then program flow is generic to specify.

Note: java only support public inheritance that means the visibility mode of the inheritance properties into sub-class, public properties of the super class becomes public properties of sub-class and protected properties of super class become protected properties sub-class.


What is String in java

Generally, String is a sequence of characters. But in Java, string is an object that represents a sequence of characters. The java.lang.String class is used to create a string object.

How to create a string object?

There are two ways to create String object:

  1. By assigning string literal

  2. By new keyword


1) String Literal

Java String literal is created by using double quotes. For Example:

String s="welcome";

Each time you create a string literal, the JVM checks the "string constant pool" first. If the string already exists in the pool, a reference to the pooled instance is returned. If the string doesn't exist in the pool, a new string instance is created and placed in the pool

2) By new keyword

String s=new String("Welcome");

//creates two objects and one reference variable  

In such case, JVM will create a new string object in normal (non-pool) heap memory, and the literal "Welcome" will be placed in the string constant pool. The variables will refer to the object in a heap (non-pool). 


Java String class methods

The java.lang.String class provides a lot of methods to work on string. By the help of these methods, we can perform operations on string such as trimming, concatenating, converting, comparing, replacing strings etc.

Java String is a powerful concept because everything is treated as a string if you submit any form in window based, web based or mobile application.


Java StringBuffer class

Java StringBuffer class is used to create mutable (modifiable) string. The StringBuffer class in java is same as String class except it is mutable i.e. it can be changed.

Note: Java StringBuffer class is thread-safe i.e. multiple threads cannot access it simultaneously. So it is safe and will result in an order.

What is mutable string

A string that can be modified or changed is known as mutable string. StringBuffer and StringBuilder classes are used for creating mutable string.


SWING 


      import javax.swing.*;    

Swing is a super set of "awt",It is a part of java foundation class (JFC) to create a window base application. It is built on top of awt API and entirely written  in java.

It provide light-weighted and platform independent component.

All the classes and Interface related to swing are available of "javax.swing" package.

Exception Handling 

The exception handling in java is one of the powerful mechanisms to handle the runtime errors so that normal flow of the application can be maintained.

What is exception?

Dictionary Meaning: Exception is an abnormal condition.

In java, exception is an event that disrupts the normal flow of the program. It is an object which is thrown at runtime.

What is exception handling?

Exception Handling is a mechanism to handle runtime errors such as ClassNotFound, IO, SQL, Remote etc.

Advantage of Exception Handling

The core advantage of exception handling is to maintain the normal flow of the application.


No comments:

INTRODUCTION TO COMPUTER NETWORKS

A Computer network consists of two or more autonomous computers that are linked (connected) together in order to: • Share resources (files...