- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to declare a local variable in Java?
Local variables are declared in methods, constructors, or blocks. Local variables are created when the method, constructor or block is entered and the variable will be destroyed once it exits the method, constructor, or block.
A local variable is the one which is declared within a method. The scope of this variable is within the method.
Example
public abstract class Sample { public static void main(String args[]){ int data = 4044; System.out.println(data); } }
Output
4044
- Related Articles
- How to declare a variable within lambda expression in Java?
- How to declare a variable in C++?
- How to declare a variable in MySQL?
- How to declare a variable in Python?
- final local variable in Java
- How to declare a global variable in C++
- How to declare a global variable in PHP?
- How to declare a global variable in Python?
- MySQL how to declare a datetime variable?
- How to declare a variable correctly in a MySQLProcedure?\n
- How to declare a variable inside a procedure in MySQL?
- Initialization of local variable in a conditional block in Java
- Can we declare a static variable within a method in java?
- How to declare a variable in MySQL for a normal query?
- How to declare and access pointer variable in Golang?

Advertisements