Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
28 lines (23 loc) · 668 Bytes

File metadata and controls

28 lines (23 loc) · 668 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package chapter09;
/*
* StaticBlockEx1.java
* Java application to demonstrate whether you can run a program without a main method * or not. *
*/
public class StaticBlockEx1 {
static {
System.out.println("This is a Java progarm with an empty main() method");
int i = 10; // Can initialize static variables
System.out.println("Variable i : " + i);
Thread t = new Thread() {
@Override
public void run() {
System.out.println("Started thread from static initializer block");
System.out.println("Thread Finished");
}
}; // end of the thread t
t.start(); // starts the thread t
}
public static void main(String args[]) {
// Empty main method
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.