Table of Contents
Full Course on JAVA
JAVA is an object oriented Programming Languages which is based on OOPs Concepts.It is a high level Programming Language.Java has a Runtime Environemnt.If you work on java then you need to install jdk and jre in your system.We call JAVA as a OOPs Concept which provides Inheritance, polymorphism etc.
OOPs Concept:
1.Object-An object is any entity that has state and behaviour. A chair, pen, table, keyboard, bicycle, etc. are a few examples. An instance of a class is one way to define an object. An object occupies some memory space and has an address.
2.Class-A class is a blueprint to create an objects.
3.Polymorphism-Polymorphism is the term for when a single task is carried out in various ways.
4.Inheritance-Inheritance is the process by which one object takes on all of the traits and characteristics of a parent item. It allows for the reuse of code.
5.Encapsulation-Encapsulation is the process of combining data and code into a single entity
6.Abstraction-Abstraction is the practise of displaying functionality while concealing internal features.
There are multiple Applications of Java
1.Mobile Applications
2.Web Applications
3.Android Applications
4.Desktop Applications
5.Games
Advantages of Java
1.You can work on Java in any platform (winow/linux/mac etc)
2.It is most powerful Computer Programming language.
3.It is Open Source platform where you can write your code and execute the code.
4.Most Secure and fast Programming Language.
5.It is an Object Oriented Programming Language and also allows the code to be reused.
4 Types of Java Applications
1.Standalone Application:This is also known as Desktop Application and most common in every system .Every System need to install .MediaPlayer,Antivirus etc are the example of Standalone Applications.
2.Web Application:An Application which is run on every Server and creates a dynamic page known as Web Applications.Example of Web Application are Hibernate,Servlet etc.
3.Enterprise Application:Banking type of Application known as Enterprise Application which can be securely high and load balancing.
4.Mobile Application:Application created for the mobilelike Android Application.
Basic Syntax of JAVA Prograame
public class A{
public static void main(String[]args)
{
System.out.pritnln(“Hi”);
}
}
Here public static void main(String[]args) means
public -It is an access modifier that describes who and from where the method can be accessed.
static-The static nature of the main() method allows JVM to call it without first creating the class.
void-The return type of the main() method is void because it doesn’t produce a result.
main-It is the Java main method’s name.
string[]args-It is a java.lang array that saves Java command-line parameters. String type.
Comments in Java Code
For readable purpose we use comment in code so that this line will not execute.Only for readable purpose.
//Hi , I am going to print “Hello world”
System.out.println(“Hello World”);
KNow More :About JAVA
DATA TYPES
There are 8 Data Types which I will describe below.
1.Byte which stores from -128 to 127.
2.short which stores from -32,768 to 32,767
3.int which stores from -2,147,483,648 to 2,147,483,647
4.long which stores from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
5.float which stores fractional number from 6 to 7 decimal digits
6.double which stores fractional number .
7.boolean which stores in True/false value
8.char which stores single character/letter or ASCII.
Types of Casting in JAVA
1.Widening Casting-which convert from smaller data type to larger data type.
byte
-> short
-> char
-> int
-> long
-> float
-> double
2.Narrowing Casting-which convert from larger data type to smaller data type.
double
-> float
-> long
-> int
-> char
-> short
-> byte
Types of OPERATORS in JAVA
OPERATORS IN JAVA are used to perform some operation in programme
These are the Operators which we can perform in JAVA Programming language.
1.ARITHMETIC OPERATORS-We can use in addition,subtraction, multiplication,division etc. for mathematical operations.
2.ASSIGNMENT OPERATORS-It is used when we assign values to variables.
3.COMPARISON OPERATORS-It is used when we can compare two values
4.LOGICAL OPERATORS-It is used to determine logic betweeen values andvariables
Strings in JAVA
String in java basically means when you write collection of character in a single quote.
String First=”ABC”;
String Concatenation
Strings can be combined by using the + operator between them.
MATH IN JAVA
1.Math.max(x,y)-The largest value of x and y can be determined using the Math.max(x,y) method.
2.Math.min(x,y)-The lowest value of x and y can be determined using the Math.min(x,y) function.
3.Math.sqrt(x)-The square root of x is returned by the Math.sqrt(x) function.
4.Math.abs(x)-The Math.abs(x) method returns the value of x that is absolute and positive.
5.Random Numbers-A random number between 0.0 (inclusive) and 1.0 (exclusive) is produced by the Math.random() function
BOOLEAN EXPRESSION IN JAVA
If you talk about boolean expression in JAVA , it means that you’ll require a data type with just one of two possible values in terms of TRUE/FALSE,YES/NO,ON/OFF.
IF/ELSE/ELSE IF/SWITCH CONDITIONS IN JAVA
1.IF-If you want to tell a block of code to run only if a certain condition is true, use the if statement.
2.ELSE-If the same condition is false, use else to describe a block of code that should be executed.
3.ELSE IF-If the first condition is false, use else if to define a new condition to test.
4.SWITCH -To define numerous different code blocks to be performed, use the switch command.
WHILE CONDITIONS IN JAVA
The while loop executes a block of code repeatedly while waiting for a certain condition to be true.
FOR LOOP CONDITIONS IN JAVA
Use the for loop rather than the while loop when you know exactly how many times you want to cycle through a section of code
BREAK/CONTINUE CONDITIONS IN JAVA
You can exit a loop by using the break command
ARRAYS IN JAVA
Arrays are used to hold numerous values in a single variable.Use square brackets to define the variable type when declaring an array.
String [] abc={“A”,”B”};
Read More:Course on SQL