Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 13th, 2005, 08:41 AM
nabil1983 nabil1983 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 36 nabil1983 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 7 m 44 sec
Reputation Power: 4
Unhappy Some code definitions and compile error???

I've done my program, it works but i keep getting the following when i compile:

Note: C:\Documents and Settings\Nabil\Desktop\CdStorage3.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

im using J Creator, wat does it mean by unchecked and unsafe operations.

i dont know what some instructions mean ne chance of an explanation:

catch(NumberFormatException ne){
menu=1;

Iterator iter = arrayLst.iterator();
while (iter.hasNext())

array = (CdRecord)iter.next();

ne chance of tellin what these pieces of code actually do in the program below..


import java.util.*;
import javax.swing.*;
public class CdStorage3
{
public static void main (String[] args)
{
CdRecord array;
List arrayLst= new ArrayList();
String menu_choice;
int menu;
while (true)
{
menu_choice =
JOptionPane.showInputDialog("Enter:\n 1: New CD entry\n 2: Print\n 3: Quit");
try {
menu = Integer.parseInt(menu_choice);
}
catch(NumberFormatException ne){
menu=1;
}
if (menu==3)
{
break;
}
else if (menu==1)
{
arrayLst.add(new CdRecord());
}
else if (menu==2)
{
Iterator iter = arrayLst.iterator();
while (iter.hasNext())
{
array = (CdRecord)iter.next();
array.printCdRecord();
}
break;
}
}
} //end main
}//end class
class CdRecord
{
private String artist_name;
private String album_name;
private int no_of_tracks;

public CdRecord ()
{
artist_name =
JOptionPane.showInputDialog("Enter Artist Name");
album_name =
JOptionPane.showInputDialog("Enter Album Name");
no_of_tracks =
Integer.parseInt(JOptionPane.showInputDialog("Enter Number Of Tracks"));
}
public void printCdRecord ()
{
System.out.println("Artist Name: " +artist_name + "\nAlbum Name: " +album_name+"\nNo. Of Tracks: " +no_of_tracks+"\n");
}
}//end class cdstorage



would apreciate all and ne help.

Reply With Quote
  #2  
Old April 17th, 2005, 04:28 AM
gertcuppens's Avatar
gertcuppens gertcuppens is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 118 gertcuppens User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 28 m
Reputation Power: 5
I found the following explanation at http://www.ociweb.com/jnb/jnbJul2003.html
The classes that make up the Collections API will be generic compatible with the release of Java 1.5.
What this means is that all classes in the Collections API have been modified to accept generic type parameters.
A program that uses classes in the Collections API without generic type parameters will continue to work
but the compiler will generate a warning stating that unsafe or unchecked operations are being used.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Some code definitions and compile error???


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT