This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
class MyFrame extends JFrame | |
{ | |
public MyFrame() | |
{ | |
this.setTitle("Example Application"); | |
this.setSize(400,400); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
import java.io.*; | |
class MyFrame extends JFrame | |
{ | |
public MyFrame() | |
{ | |
this.setTitle("Example Application"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
public class Sequence | |
{ | |
/* A static block. Called only once, the first | |
time you are accessing the class. Static block is | |
executed before class is loaded. */ | |
static | |
{ | |
System.out.println("Executing static block.."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Alpha | |
{ | |
String getType() | |
{ | |
return "alpha"; | |
} | |
} | |
class Beta extends Alpha | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
interface StartStop | |
{ | |
public abstract void start(); | |
public abstract void stop(); | |
} | |
class Car implements StartStop | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
class Feline | |
{ | |
String type = "f"; | |
public Feline() | |
{ | |
System.out.println("feline"); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
interface Shape | |
{ | |
public void draw(); | |
} | |
class Square implements Shape | |
{ | |
@Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
class A implements Cloneable | |
{ | |
public int data; | |
public A(int data) | |
{ | |
System.out.println("Constructor called"); | |
this.data = data; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
class A implements Comparable<A> | |
{ | |
private int data; | |
public A(int data) | |
{ | |
this.data = data; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
class MyThread extends Thread | |
{ | |
private String threadName; | |
MyThread(String threadName) | |
{ | |
this.threadName = threadName; | |
System.out.println("Creating Thread " + this.threadName); | |
} |