2nd step to Java
https://letsknowaboutcomputer.blogspot.com/2011/12/2nd-step-to-java.html
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
3 different types of data that can be stored in variables.
Declaring variables
Constants
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
If there are no errors in your source file, the Java compiler will produce one or more .class files.
Variable typesData 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
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 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;
}
}