View Single Post
  #5 (permalink)  
Old 04-24-2007, 02:12 PM
John's Avatar   
John John is online now
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,468
Last Blog:
Joomla! And Incompeten...
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default

You extend classes in the class header. For example, a class that would extend JFrame might look something like this:

Code:
package helloworld;

import javax.swing.*;

public class MySecondApp extends JFrame {
	
	public MySecondApp(){

	}
	public static void main(String[] args) {
		new MySecondApp();
	}
}
MySecondApp is a sub-class or child of the super-class/parent JFrame. It has the same ability of its parent, with the ability to add on (extend) the parents functionality with more methods. I've never attempted to extend classes within the same class file, but your second example does look OK.
Reply With Quote

Sponsored Links