Java Program Complication error

Java Program Complication error

View Answers

October 10, 2009 at 1:14 PM

Hi Friend,

The "use unchecked or unsafe operations" warning indicates that you have missed a type declaration.

We have modified your code.Try it.

import java.util.ArrayList;

public class ThreeArrayLists {

public static void main(String[] args) {
ArrayList<Double> priceList = new ArrayList<Double>();
ArrayList<Double> quantityList = new ArrayList<Double>();
ArrayList<Double> amountList = new ArrayList<Double>();

priceList.add(new Double(10.62));
priceList.add(new Double(14.89));
priceList.add(new Double(13.21));
priceList.add(new Double(16.55));
priceList.add(new Double(18.62));
priceList.add(new Double(9.47));
priceList.add(new Double(6.58));
priceList.add(new Double(18.32));
priceList.add(new Double(12.15));
priceList.add(new Double(3.98));

quantityList.add(new Double(4.0));
quantityList.add(new Double(8.5));
quantityList.add(new Double(6.0));
quantityList.add(new Double(7.35));
quantityList.add(new Double(9.0));
quantityList.add(new Double(15.3));
quantityList.add(new Double(3));
quantityList.add(new Double(5.4));
quantityList.add(new Double(2.9));
quantityList.add(new Double(4.8));

for (int i = 0; i < 10; i++) {
amountList.add((Double.valueOf(priceList.get(i).toString())) * (Double.valueOf(quantityList.get(i).toString())));
System.out.printf("%d) %.2f * %.2f = %.2f \n",i+1, Double.valueOf(priceList.get(i).toString()), Double.valueOf(quantityList.get(i).toString()), Double.valueOf(amountList.get(i).toString()));
}
}
}

Thanks









Related Tutorials/Questions & Answers:
Java Program Complication error - Java Beginners
Java Program Complication error  Hi there, I have this program I had to write called ThreeArrayLists.java, but I keep getting this error "use of unchecked or unsafe operations" This is the criteria for the program
Java Complication Error - Java Beginners
Java Complication Error  Hello there, I was assigned to do a project in java that I have to set up tabs and in each tab have something in them. Well... this error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
Advertisements
Java Complication Error - Java Beginners
Java Complication Error  Hello there, I was assigned to do a project in java that I have to set up tabs and in each tab have something in them. Well... this error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
why the program is showing error?
why the program is showing error?  <%@page import="java.sql.*"%>...; It is showing the error: An error occurred at line: 33 in the jsp file...=Integer.parseInt(rs1.getString(10)); 36: i=i+k; An error occurred at line
Program error - WebSevices
Program error  Hello, Any one know the sample program for Login page using zend framework. Then how i connect my databse file to zend framework. Anyone help me
ERRor in executing DB program
ERRor in executing DB program  While executing following code an Error was generated.can any one help me for this. LiveDB liveDBObj...=pstmt.executeUpdate(qry); ---------- **ERROR:java.sql.SQLException: You have
Program error - WebSevices
Program error  Hello friends, Username Required Password Required.... In which library file i include the top of my program.... Any one help me
Program error - WebSevices
Program error  Dear all, How i insert checkbox values into my database without using array In PHP . Anyone know the code
Program error - WebSevices
Program error  Dear all, How i insert checkbox values into my database without using array. Anyone know the code.   Hi friend, Code to help in solve the probelm : Insert CheckBox
Program Error - WebSevices
Program Error  Hello Friends, Write the simple php program Using Zend framework with Database connection .Anyone know the code .Help me   Hi friend, I am sending simple code of using Zend Framework
error in program when trying to load image in java - Java Beginners
error in program when trying to load image in java  Hi, I'm trying to add an image to my GUI using java graphics. I have cleaned up all my compiler errors but my program still won't run. I keep getting this type of message and I
what error in this program plese correct it
what error in this program plese correct it  import java.io.*; class y { public static void main (String args[]) { Data inputStream dis = new Data inputstream(System.in); float l,b,a; Systyem.out.println("enter the lengh"); l
Exception Handling-Error Messages in Program
Exception Handling-Error Messages in Program  Hi Friend, I am having... with this. Here is the code with the error messages as Follows: import...[]) throws Exception{ This is where I begin to see problems with error messages
Java error stream
Java error stream       The Java error stream is used to print error that arises during the execution of a program. The execution of program display an output and error
Exception Handling-Error Messages in Program
Exception Handling-Error Messages in Program  Sorry about the first code block: import java.util.*; class GradeException extends Exception{ public GradeException(String s){ System.out.println(s); } } ----jGRASP exec: javac -g C
I/O Program output error
I/O Program output error  Hello All, I am working on a program... of the program in that it reads the text file and analyzes it, however I need it to take... java.util.TreeSet; /** * * @author zubeda.a.hemani */ //This program reads
HTTP 500 Internel server error in Custom tag program on Weblogic 8.1 - Java Beginners
HTTP 500 Internel server error in Custom tag program on Weblogic 8.1  Dear sir, Please attend my problem... I face the Error 500 Internel server error when I run the custom tag program on weblogic 8.1. My program Structure
i got an error while compile this program manually.
i got an error while compile this program manually.  import javax.servlet.http.*; import org.apache.struts.action.*; public class ActionOne{ public...,struts jar files and i got an error in saveErrors() error Heading cannot find
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... the GUI as it is more reliable and efficent - the current program that i am working... that the program recquires a main() method in order to be runned - here is the following code
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... the GUI as it is more reliable and efficent - the current program that i am working... that the program recquires a main() method in order to be runned - here is the following code
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... the GUI as it is more reliable and efficent - the current program that i am working... that the program recquires a main() method in order to be runned - here is the following code
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... the GUI as it is more reliable and efficent - the current program that i am working... that the program recquires a main() method in order to be runned - here is the following code
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... the GUI as it is more reliable and efficent - the current program that i am working... that the program recquires a main() method in order to be runned - here is the following code
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... the GUI as it is more reliable and efficent - the current program that i am working... that the program recquires a main() method in order to be runned - here is the following code
Error in Custom tag program - JSP-Servlet
Error in Custom tag program  Dear Sir,This is my problem concern to custom tag.Please review.. Browser show: Browser show: Parsing of JSP... to an error in /Home.jsp line 1
Java error
Java error  class WhileLoopMethod{ public static void main(String args[]){ new Hello(); } } class Hello{ int a = 5, b = 88; while(a } //it is giving compile time error .....illegal start
Java error
Java error  class WhileLoopMethod{ public static void main(String args[]){ new Hello(); } } class Hello{ int a = 5, b = 88; while(a } //it is giving compile time error .....illegal start
How to eliminate error," Could not find the main class: filecopy.FileCopy. Program will exit." ?
class: filecopy.FileCopy. Program will exit. Exception in thread "main" Java...How to eliminate error," Could not find the main class: filecopy.FileCopy. Program will exit." ?  run: java.lang.NoClassDefFoundError: filecopy
java program for
java program for   java program for printing documents,images and cards
Error 500-Server are not find the jar file in the program of upload the file - JSP-Servlet
Error 500-Server are not find the jar file in the program of upload the file  Hello Sir, your response: Hi friend, The 500 Internal Server Error is a "server-side" error, meaning the problem is not with your PC or Internet
a Java program
a Java program    Write a Java program to print even numbers from 2 to 1024? Write a Java program to print ? My Name is Mirza? 100 times? Write a Java program to print Fibonacci Series? Write a Java program to reverse a number
Java Program
Java Program  A Java Program that print the data on the printer but buttons not to be printed
java program
java program  write a java program to read a file content into a string object using available and read methods of java bufferedinputstream.   Please visit the following link: http://www.roseindia.net/java/example/java
program created and compilation error of connection rightly created n tested
program created and compilation error of connection rightly created n... error for connection on which other programs are running smoothly...:( import... ("there was some error in establishing connection : "+e); } sep
java program
java program  write a program to print 1234 567 89 10
java program
java program  Write a program to demonstrate the concept of various possible exceptions arising in a Java Program and the ways to handle them.  ... in Java
java program
java program  write java program for constructor,overriding,overriding,exception handling
java program
java program  how to write an addition program in java without using arithematic operator
java program
java program  write a java program to display array list and calculate the average of given array
java program
java program  write a java program to display array list and calculate the average of given array
Java Program
Java Program  java program to insert row in excel sheet after identifying an object
java program
java program  java program to implement the reflection of a particular class details like constructor,methods and fields with its modifiers
java program
java program  Write a java program to do matrix addition operation On two given matrices
java program
java program  Write a java program to find the number of Positive numbers in m* n matrix
java program
java program  Write a program to create an applet and display The message "welcome to java
java program
java program  hi friends how to make a java program for getting non prime odd numbers in a given series
java program
java program  write an error.jsp , which will be called in case there will be any run time error in the system , page crash
java program
java program   Write a program to find the difference between sum of the squares and the square of the sums of n numbers
java program
java program  write a program to create text area and display the various mouse handling events
java program
java program  Develop the program calculatePipeArea. It computes the surface area of a pipe, which is an open cylinder. The program accpets three values: the pipes inner radius, its length, and the thickness of its wall

Ads