// Demonstrate static variables, methods, and blocks. static void meth(int x) { static { public static void main(String args[]) { |
class StaticDemo { static void callme() { class StaticByName { |
// This program demonstrates the length array member. class Length { public static void main(String[] args) { int a1[] = new int[10]; int a2[] = { 3, 5, 7, 1, 8, 99, 44, -10 }; int a3[] = { 4, 3, 2, 1 }; System.out.println("length of a1 is " + a1.length); System.out.println("length of a2 is " + a2.length); System.out.println("length of a3 is " + a3.length); } } |
// Improved Stack class that uses the length array member. // allocate and initialize stack // Push an item onto the stack // Pop an item from the stack class TestStack2 { |
// Demonstrate an inner class. void test() { // this is an inner class class InnerClassDemo { |
// Define an inner class within a for loop. void test() { class InnerClassDemo2 { |