Home
»
Java Program
» static block , statric block simple test program, static block program using static key word , static block concept, simple concept of static blok, program for static keyword using if condition, simple if condition in static blok,static block in java
static block , statric block simple test program, static block program using static key word , static block concept, simple concept of static blok, program for static keyword using if condition, simple if condition in static blok,static block in java
Java Program for Static Block
class StaticBlock
{
public static void main(String[] args)
{
System.out.println("Main method is executed.");
}
static
{
System.out.println("Static block is executed before main method.");
}
}
class StaticBlock
{
public static void main(String[] args)
{
System.out.println("You are using Windows operating system.");
}
static
{
String os = System.getenv("OS");
if (os.equals("Windows_NT") != true)
{
System.exit(1);
}
}
}
0 comments:
Post a Comment