This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Arrays asList() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Arrays asList() method" Watch "Arrays asList() method" New topic
Author

Arrays asList() method

Saibabaa Pragada
Ranch Hand

Joined: Oct 24, 2010
Posts: 162
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2095
    
    7
Not exactly sure what is going on but Lists are only for Objects. Not sure what happens when you try to use a primitive array.

Try the following and it works as you expect:



Edit: it looks like it just returns the original array:

Subhasis Gorai
Greenhorn

Joined: Dec 13, 2010
Posts: 3
Please check this topic, hope it helps ..
http://www.coderanch.com/t/510492/java-programmer-SCJP/certification/Arrays-asList
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Arrays asList() method
 
Similar Threads
is this a proper mock question for the exam?
Doubt on Local Arrays
Triangle Problem
Doubt in ArrayList's toArray function
Cast Object to Object[]