The Artima Developer Community
Sponsored Link

Java Answers Forum
an ArrayList exceptions problem

1 reply on 1 page. Most recent reply: Mar 11, 2002 12:39 AM by SrinivasaraoCh

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Amber K

Posts: 6
Nickname: amberk
Registered: Mar, 2002

an ArrayList exceptions problem Posted: Mar 10, 2002 9:47 AM
Reply to this message Reply
Advertisement
Problem type: Array List / Java Data Structures
Problem: For each of the following program segments, determine if the segment would generate a compile-time error(CT-E), a run-time exception(RT-E) or neither (NONE).

a. ArrayList myList = new ArrayList();
myList.add("Yes");
myList.add (new Integer(7));

b. ArrayList original = new ArrayList();
original.add("Yes");
ArrayList copy = original.clone();

c. ArrayList newList = new ArrayList();
newList,add("Yes");
Integer answer = (Integer) newList.get(0);

------------------------------------------------------
A posted complete solution would be awesome! and thank you in advance!

Amber :)


SrinivasaraoCh

Posts: 3
Nickname: seenu
Registered: Mar, 2002

Re: an ArrayList exceptions problem Posted: Mar 11, 2002 12:39 AM
Reply to this message Reply
Dont you have JDK to compile?

Flat View: This topic has 1 reply on 1 page
Topic: How to make a  class instance ? Previous Topic   Next Topic Topic: Java Code

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use