Two Laptop Bag*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes question about arrays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "question about arrays" Watch "question about arrays" New topic

question about arrays

saima kanwal
Ranch Hand

Joined: Oct 05, 2009
Posts: 148
consider the following code:

this does not compile. Can anyone tell me what is the problem with this code. Actually what i feel is that there is some problem when i assign the {1,5} array to c.arr in the main. but if i initialize it at the time of declaration , it works fine. but on the other hand this is not the case with the int num variable.why is that happening??

SCJP 6.0 (86%) SCWCD 5 (94%)
Minhaj Mehmood
Ranch Hand

Joined: Jan 22, 2007
Posts: 400

change line 7 to

SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
saima kanwal
Ranch Hand

Joined: Oct 05, 2009
Posts: 148
thanks. i got my mistake.
I agree. Here's the link:
subject: question about arrays
Similar Threads
Java Rule Round-Up
Regarding Serialization
Need help with columns of Pyramid of numbers
Restriction on Constants
While Loop Problem