2nd step to Java

Before we go to learn coding , lets learn something important.
JDK Utilitiesjavac   Java compiler. Converts Java source code into bytecodes.
java    Java interpreter. Executes Java application bytecodes directly from class files.
appletviewer   A Java interpreter that executes Java applet classes hosted by HTML files.
rmic   Creates class files that support Remote Method Invocation (RMI).
rmiregistry   Registry used to gain access to RMI objects on a specific machine.
jar   Java Archive (JAR) file generator. JAR files allow multiple Java classes and resources to be distributed in one compressed file.

How the code compiles
Variable types
Data types used to store data at specific memory locations.

3 different types of data that can be stored in variables.
Integers are whole numbers such as 1,2,3,..
Real numbers have a decimal point in them such as 1.89 or 0.12.
Character variables store only 1 letter of the alphabet.
Boolean variables can store 1 of 2 values which are True or False.

Name           Type            Values
byte              Numeric      Integer-128 to 127
short             Numeric      Integer-32 768 to 32 767
int                Numeric       Integer-2 147 483 648 to 2 147 483 647
long             Numeric       Integer-9 223 372 036 854 775 808 to 9 223 372 036 854 775 807
float             Numeric       Real-3.4 * 1038 to 3.4 * 1038
double         Numeric       Real-1.7 * 10308 to 1.7 * 10308
char            Character     All unicode characters
String          Character     All unicode characters
boolean       Boolean       True or False

Declaring variables
public class Variables
{
   public static void main(String[] args)
   {
      int myVariable;
      int myVariable, myOtherVariable;
      myInteger = 5;
 //  or
      int myInteger = 5;
      String myString = "Hello";
      System.out.println(myInteger);     // to print output on console
      System.out.println(myString);//system.out.print is to print,ln for new line

   }
}


OperatorOperation

+ Addition
- Subtraction
* Multiplication
/ Division
% Remainder

Constants
Constants are variables with values that can't be changed.

syntax(way to write in specific language)

public class Variables
{
   public static void main(String[] args)
   {
      final double PI = 3.14;
   }
}

Related

JAVA 1680114502526839710

Post a Comment

emo-but-icon

item
href="http://www.ariyan.org">Wordpress