Saturday, 30 July 2016
JAVAHELLOWORD
JavaSimple code ?
abstract
In front of a `class` keyword, prevents this class to be directly instantiated. In front of a method signature, allows the implementation of this method to be deferred to an inheriting class.assert
Assert describes a predicate (a true–false statement) placed in a java-program to indicate that the developer thinks that the predicate is always true at that place. If an assertion evaluates to false at run-time, an assertion failure results, which typically causes execution to abort. Optionally enable by ClassLoader method.boolean
Defines a boolean variable for the values "true" or "false" only (NB: "null" as in class Boolean is not allowed).break
Used to end the execution in the current loop body.class
A type that defines the implementation of a particular kind of object. A class definition defines instance and class fields, methods, and inner classes as well as specifying the interfaces the class implements and the immediate superclass of the class. If the superclass is not explicitly specified, the superclass is implicitly Object. The class keyword can also be used in the form Class.class to get a Class object without needing an instance of that class. For example, String.class can be used instead of doing new String().getClass().const
Although reserved as a keyword in Java, const is not used and has no function.[2][1] For defining constants in java, see the 'final' reserved word.Tuesday, 26 July 2016
What is Variable in java
A variable can provide to store the program each of the java Variable has type .
this type is determines the size and layout of the variable memory .and also the rang of value is store the memory .
Main Three type of Variable .
Local Variable
StaicVariable
instance Variable
Local variables:
Class/static variables:
Class Variable in java and Explain the Details .code the class variable
import java.io.*; public class vipul{ private static double salary; // DEPARTMENT is a constant public static final String DEPARTMENT = "Development "; public static void main(String args[]){ salary = 1000; System.out.println(DEPARTMENT + "average salary:" + salary); } }
Instance variables:
- Instance variables are declared in a class, but outside a method, constructor or any block.
- When a space is allocated for an object in the heap, a slot for each instance variable value is created.
- Instance variables are created when an object is created with the use of the keyword 'new' and destroyed when the object is destroyed.
- Instance variables hold values that must be referenced by more than one method, constructor or block, or essential parts of an object's state that must be present throughout the class.
- Instance variables can be declared in class level before or after use.
- Access modifiers can be given for instance variables.
- The instance variables are visible for all methods, constructors and block in the class. Normally, it is recommended to make these variables private (access level). However visibility for subclasses can be given for these variables with the use of access modifiers.
- Instance variables have default values. For numbers the default value is 0, for Booleans it is false and for object references it is null. Values can be assigned during the declaration or within the constructor.
- Instance variables can be accessed directly by calling the variable name inside the class. However within static methods and different class ( when instance variables are given accessibility) should be called using the fully qualified name . ObjectReference.VariableName.
Monday, 25 July 2016
Setp TO Run Java Program
how to Run java Code wtih demo?
they Follws many Setp .
Setp-1
First Setp is Open Cmd Commant Promt .
Setp-2 After that Check Your JDK is Install or not so Write Comment JAVAC .
Setp-3 Message is come this tpye than Understand the Java Jdk is Install otherwise
you need to Install form you pc or Laptop After Follows this Setp.
Setp-4 After Cls Commant to Clear youe CMD and Write JAVAC Comment that Commant is Used
to Complie your javacode. to Create the class FILE of CODE and RUN them.
Setp-5 Now Compile youe code than wite only Java And CLASS Name Like A
Any Eorro is Come than it Dispaly and Slove it not any Error than Run Successfull.
Setp-6 Final Not Any Error in your Code then output is see in CMD comment.
they Follws many Setp .
Setp-1
First Setp is Open Cmd Commant Promt .
Setp-2 After that Check Your JDK is Install or not so Write Comment JAVAC .
Setp-3 Message is come this tpye than Understand the Java Jdk is Install otherwise
you need to Install form you pc or Laptop After Follows this Setp.
Setp-4 After Cls Commant to Clear youe CMD and Write JAVAC Comment that Commant is Used
to Complie your javacode. to Create the class FILE of CODE and RUN them.
Setp-5 Now Compile youe code than wite only Java And CLASS Name Like A
Any Eorro is Come than it Dispaly and Slove it not any Error than Run Successfull.
Setp-6 Final Not Any Error in your Code then output is see in CMD comment.
Alll THE BEST
Sunday, 24 July 2016
Saturday, 23 July 2016
Friday, 22 July 2016
Thursday, 21 July 2016
How to set Path of java JDK and How To run java code
After the Dwonload jdk or java softwer than After we need to set the java path before java code is not run in NetBeans or Ecilps .
Setting of the Path os Windows and than set the path and Access java code any Error than come with hight light and also Huamn can Easly slove the Error of Java Code How Has Knowlege of java Laguage.
Tools of Java And Use of Tools
java is a programing Language and also that is different type of tools to perform the platform
and also java is Many type of tools is available to use a java Programing ans Basic are list out under they most of use today
---------------- javaJdk 8
-----------------jdk6.0
----------------jdk7.0
-------------------jdk all version
they are Accress to 64MB OF RAM
---------------128 MB RAM
Tuesday, 12 July 2016
Monday, 11 July 2016
Saturday, 9 July 2016
Thursday, 7 July 2016
Wednesday, 6 July 2016
What is java Modifiers?
There are two types of modifiers in java: access modifiers and non-access modifiers.
The access modifiers in java specifies accessibility (scope) of a data member, method, constructor or class.
There are 4 types of java access modifiers:
- private
- default
- protected
- public
private access modifier
If you make any class constructor private, you cannot create the instance of that class from outside the class.
class vipul{
private vipul()
{
}//private constructor
void msg()
{
System.out.println("Hello java");
}
}
public class Simple
{
public static void main(String args[])
{
vipul obj=new vipul();//Compile Time Error
}
}
default access modifier
we have created two packages pack and mpack. We are accessing the VIPUL class from outside its package, since VIPUL class is not public, so it cannot be accessed from outside the package.
//save by VIPUL.java
package pack;
class VIPUL
{
void msg()
{
System.out.println("Hello");
}
}
//save by Agravat.java
package mpack;
import pack.*;
class Agravat
{
public static void main(String args[]){
VIPUL obj = new VIPUL();//Compile Time Error obj.msg();//Compile Time Error
}
}
the scope of class VIPUL and its method msg() is default so it cannot be accessed from outside the package.
protected access modifier
The protected access modifier is accessible within package and outside the package but through inheritance only.
The protected access modifier can be applied on the data member, method and constructor. It can't be applied on the class.
//save by VIPUL.java
package pack;
public class VIPUL
{
protected void msg()
{
System.out.println("Hello");
}
}
we have created the two packages pack and mpack. The VIPUL class of pack package is public, so can be accessed from outside the package. But msg() method of this package is declared as protected, so it can be accessed from outside the class only through inheritance.
//save by Agravt.java
package mpack;
import pack.*;
class Agravat extends VIPUL
{
public static void main(String args[])
{
Agravat obj = new Agravat();
obj.msg();
}
}
print "Hello"..........
public access modifier
What is Class
What is Class Explain With Example?
Class is Nothing but it template for object.In simple word class is a pattern which define any of Object.
when we create class in java first step we write Keyword Class and give the name of class.
class is define in curly Brace {} in between write the java code.
Syntext
Class NAME OF CLASS
{
}
Example
Class A
{
// java code
}
we can Created Multiple class in Single Program.
Programmer can define nested Class
Class is Nothing but it template for object.In simple word class is a pattern which define any of Object.
when we create class in java first step we write Keyword Class and give the name of class.
class is define in curly Brace {} in between write the java code.
Syntext
Class NAME OF CLASS
{
}
Example
Class A
{
// java code
}
we can Created Multiple class in Single Program.
Programmer can define nested Class
Tuesday, 5 July 2016
What Is Interface
What Is Interface?
Interface in java is core part of programing,java is advance concept use Interface.it use that use the key word of INTERFACE.
main use of interface is java is not support multiple inheritance so avoid this problem java is use interface but interface is only Implement it can not extends like class
we can use multiple interface it must be implement.interface only deceleration part inside a interface
Syntax
public interface one
{
//method name
}
example
interface one
{
void show();
void disply();
void ex();
}
Example of Interface?
Interface is not a class.
java is not support multiple inheritance so class is extends it will not implement.
so avoid this drawback java is use the interface it can be not Extends .
interface must be Implement .
EXAMPLE
Interface in java is core part of programing,java is advance concept use Interface.it use that use the key word of INTERFACE.
main use of interface is java is not support multiple inheritance so avoid this problem java is use interface but interface is only Implement it can not extends like class
we can use multiple interface it must be implement.interface only deceleration part inside a interface
Syntax
public interface one
{
//method name
}
example
interface one
{
void show();
void disply();
void ex();
}
Example of Interface?
Interface is not a class.
java is not support multiple inheritance so class is extends it will not implement.
so avoid this drawback java is use the interface it can be not Extends .
interface must be Implement .
EXAMPLE
interface Animal { public void eat(); public void travel(); }
public class VIPUL implements Animal{ public void eat(){ System.out.println("Mammal eats"); } public void travel(){ System.out.println("Mammal travels"); } public int noOfLegs(){ return 0; } public static void main(String args[]){ VIPUL = new VIPUL(); m.eat(); m.travel(); } }
What Is Interface
What Is Interface?
Interface in java is core part of programing,java is advance concept use Interface.it use that use the key word of INTERFACE.
main use of interface is java is not support multiple inheritance so avoid this problem java is use interface but interface is only Implement it can not extends like class
we can use multiple interface it must be implement.interface only deceleration part inside a interface
Syntax
public interface one
{
//method name
}
example
interface one
{
void show();
void disply();
void ex();
}
Example of Interface?
Interface is not a class.
java is not support multiple inheritance so class is extends it will not implement.
so avoid this drawback java is use the interface it can be not Extends .
interface must be Implement .
EXAMPLE
Interface in java is core part of programing,java is advance concept use Interface.it use that use the key word of INTERFACE.
main use of interface is java is not support multiple inheritance so avoid this problem java is use interface but interface is only Implement it can not extends like class
we can use multiple interface it must be implement.interface only deceleration part inside a interface
Syntax
public interface one
{
//method name
}
example
interface one
{
void show();
void disply();
void ex();
}
Example of Interface?
Interface is not a class.
java is not support multiple inheritance so class is extends it will not implement.
so avoid this drawback java is use the interface it can be not Extends .
interface must be Implement .
EXAMPLE
interface Animal { public void eat(); public void travel(); }
public class VIPUL implements Animal{ public void eat(){ System.out.println("Mammal eats"); } public void travel(){ System.out.println("Mammal travels"); } public int noOfLegs(){ return 0; } public static void main(String args[]){ VIPUL = new VIPUL(); m.eat(); m.travel(); } }