Data types and Variables in Java

Variable is a memory location in a program.There are three types of variables that a Java program can have.

1.local variable.

2Instance variable.

3.Static variable.

Variables can be changed, i.e., they can be varied.We can define variable also as a reserved memory location.

For Example.

Types of Variables in Java

variables in java

As I mentioned earlier, there are three kinds of variables in Java.

variables in Java

1.Local Variable

It’s a variable which has been declared inside a method.This variable cannot be accessed outside the method.

Example.

2.Instance variables

These are variables declared outside a method but inside a class.

3.Static Variables

These are variables declared with static keyword, and they can never be local variables.


Data Types in Java

Data types are different values that can be assigned a memory location, i.e., a variable.Two data types in Java are.
1.Primitive data type

2.Non-primitive data types

Data types in java

data-types-in-java-and-default-values

Next Topic: Unicode System in Java Programming Language

previousnext

About the Author: Eric K

My name is Eric.Am a software developer with skills in Php,Mysql, Java , Android,Node.js Above all, I have certification in Cisco Networking Associate (CCNA) and holds degree in Information Technology. Hire me: Email : kawi3462@gmail.com