In this tutorials we will discussed more about variables in java programming of Local Variables.
Types of variables:
Class Or StaticInstance
Local
Parameters Or Arguments
What we need before start the code, I'm using as mention below and already installed in my system:
1. JDK1.6 or +
2. Eclipse
3. Windows OS
4. Basic knowledge of java
Let's start:
Verify the JDK installation
Open the command prompt and verify the java installation
Type the
C:\>javac -version
javac 1.7.0_25
C:\>java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) Client VM (build 23.25-b01, mixed mode, sharing)
Now java installation got verified, as installed JDK1.7.0_25
Verify the Eclipse installation
Go the the installation directory of eclipse and click on the eclipse.exe
Create the new java project in Eclipse
Open the eclipse
File
New
Java project
Type the project name: Variables_In_Java_Programming
Next
Finish
Create the LocalVariableInJava.java file
Right click on the src created under project Variables_In_Java_Programming
New
Class
Type the name of class: LocalVariableInJava
Type the package name: com.variables.atozexamples
Finish
package
com.variables.atozexamples;
public class LocalVariableInJava
{
public
LocalVariableInJava() {
// TODO Auto-generated
constructor stub
}
public static void print() {
int a = 50, b = 55, c = a + b;
int a1_$ = 50;
int b1_$ = 50;
int c1_$ = a1_$ + b1_$;
System.out.println("Output of
print() method variable a = " + a + ", b = " + b + " and c
="
+ c);
System.out.println("Result of c
="
+ c1_$);
}
public static void main(String[] args) {
// Local Variables
int a = 10;
int b = 20;
int c = a + b;
System.out.println("Output of
main() method variable a = " + a + ", b = " + b + " and c
="
+ c);
// Calling the
static print method
print();
}
}
All about Local variables in java programming.
Python, Nexus, Git, and Apache maven Full Courses in Python, Nexus, Git, and Apache maven Full Courses or you can join our YouTube channels CloudNixiaSS.
ReplyDelete