
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Are Static Local Variables Allowed in Java?
Unlike C, C++, Java does not allow static local variables. The compiler will throw the compilation error.
Example
Create a java class named Tester.
Tester.java
public class Tester { public static void main(String args[]) { static int a = 10; } }
Output
Compile and Run the file to verify the result.
Tester.java:3: error: illegal start of expression static int a = 10;
Advertisements