Lost Password?

  #1 (permalink)  
Old 01-11-2007, 02:00 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 19
Posts: 2,731
Last Blog:
Passwords
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John
Default Java:Tutorial - Importing Files

This tutorial will show you how to “include” other classes in your Java app.

Prerequisites
You should have JDK installed and an editing environment you are comfortable with.
Java:Tutorial - Getting Started

You should know how to create classes within your IDE
http://forum.codecall.net/java-tutorials/1706-java-tutorial-hello-world.html

The Idea
In Java, you have the opportunity to import other class files that do most of the work for you.

Solution
In Java we import class files by simply writing the word include and then the path to the file you want to include. For example

Code:
import javax.swing.JFrame;
Which imports the JFrame class. You could also do this
Code:
import javax.swing.*;
The asterisk imports everything in the javax.swing package. The import code is placed after your package declaration and before your class header. For example:
Code:
package foobar;
import javax.swing.*;
public class MyClass {

}
Along the same lines you can import your own files in your own package. For example, if you name a package “mypackage” and in that package there is a class called “myclass” you can import that class like this:

Code:
import mypackage.myclass.*;
Conclusion
When programming in Java you are provided with many classes that do all the hard work for you. When creating even a basic program you will import at least one class.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
.QSD files reader program SamehSpiky C and C++ 8 05-21-2008 11:42 AM
How do I read .mbm (Multi BitMap) files? moondog General Programming 7 08-07-2007 07:08 AM
location of download files and configuration problem meimei3936 ionFiles 4 06-29-2007 06:28 AM
Java Help Files xXHalfSliceXx Java Help 3 11-28-2006 11:30 PM
Help Files Chan General Programming 2 10-22-2006 06:44 PM


All times are GMT -5. The time now is 12:05 AM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
LogicKills ........ 20.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 67%

Ads