- 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 static String array in Java
Following program shows how to declare a static string array.
Example
public class Tester { private static String[] array; static { array = new String[2]; array[0] = "Hello"; array[1] = "World"; } public static void main(String[] args) { System.out.println("Array: "); for(int i = 0; i < array.length; i++){ System.out.print(array[i] + " "); } } }
Output
Array: Hello World
- Related Articles
- How to declare an empty string array in C#?
- How to declare an Array Variables in Java?
- Can we declare a static variable within a method in java?
- How to declare Java array with array size dynamically?
- Can We declare main() method as Non-Static in java?
- Declare static variables and methods in an abstract class in Java
- How to declare a class in Java?
- How to declare a constructor in Java?
- Can we declare an abstract method final or static in java?
- How to declare, create, initialize and access an array in Java?
- how can I declare an Object Array in Java?
- How to declare String Variables in JavaScript?
- How to declare a two-dimensional array in C#
- How to declare a local variable in Java?
- How to sort a String array in Java?

Advertisements