• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

three or four array by declartion like this?

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
7 Which of the given choices are true?Select any two.
1 class Q3
2 {
3 public static void main(String arg[])
4 {
5 int[] a,c,d[];
6 int b[]=new int[0];
7 }
8 }
options :
1) All the variables a,b,c,d are arrays.
2) Only a,d,b are arrays.
3) We can declare an array with zero element.
4) We cannot declare an array with zero element.
i thought the answers were 2& 3 but when i checked it was as 1 & 3. please let me know whether i am correct or not and why in case i am wrong .
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you think "c" is not an array object?

Originally posted by james gong:
7 Which of the given choices are true?Select any two.
1 class Q3
2 {
3 public static void main(String arg[])
4 {
5 int[] a,c,d[];
6 int b[]=new int[0];
7 }
8 }
options :
1) All the variables a,b,c,d are arrays.
2) Only a,d,b are arrays.
3) We can declare an array with zero element.
4) We cannot declare an array with zero element.
i thought the answers were 2& 3 but when i checked it was as 1 & 3. please let me know whether i am correct or not and why in case i am wrong .



------------------
Java Lover From Hell!
 
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi James,
I know where the confusion lies...keep following in mind..
When you declare like- int[] a,b,c,d; All variables become array variables.
But when you declare like..
int a[],b,c,d; Only a is an array, rest all are normal int variables.
Hope it helps u
Thanx
 
james gong
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi swati bannore
Thank you very much ,you are greate!
I know the difference about int[] a,b,c and int a[] ,b ,c;
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be more clear if it were written this way:


[This message has been edited by marilyn murphy (edited August 29, 2001).]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic