Originally posted by umut uzumcu:
... but it gives me error...
Originally posted by umut uzumcu:
.. I tryed everthing![]()
Joanne
String name="hey";
Name[] objArr = new Name[10];
Help please i m new in Java and trying to da that last few day, there is no way i can. Its my project.
may be thats why i cant explain my problem or may be because i m new in Java. Thank you for your and everybody's help and time.
Originally posted by umut uzumcu:
The reason i m trying to add the string in to the Student assay object is because I need to save it there.
Briefly the program should get the student name from the Student class(which i can do that) and then i need to add it to the Student array obj.
Entia non sunt multiplicanda praeter necessitatem
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joanne
Originally posted by umut uzumcu:
The reason i m trying to add the string in to the Student assay object is because I need to save it there.
Briefly the program should get the student name from the Student class(which i can do that) and then i need to add it to the Student array obj.
Would it be possible to print the names of the student from an array of Students? if so, how?
Originally posted by umut uzumcu:
but the problems is the question says "add Student to the Student object array".
[ January 10, 2007: Message edited by: umut uzumcu ]
Joanne
Basically, here you are saying "i need to do it because i need to do it".The reason i m trying to add the string in to the Student assay object is because I need to save it there.
Do you need to store the name in the object IN the student array? in other words, the array is an object, that contains other objects. your array seems to contain a Student already. do you want to put the name String into that Student object inside the array?I need to store the names of the students into the Student array object
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Note that it doesn't say 'add student name to the Student object array'
You are already adding the Student to the array. Thats what the line
code:
--------------------------------------------------------------------------------
objStd[i]=obj;
If i said "I have a container that can ONLY hold eggs - NOTHING else is allowed", would you insist on putting a bowling ball in it?
no. it's the same thing. name is a String. your array holds Students. they are DIFFERENT. you CAN'T do it.
WHY are you insisting upon storing a String there? what are you trying to accomplish?
Originally posted by umut uzumcu:
What do you think about this sentence
The Storage class contains an array of Student objects. The class should define a method which accepts an instance of the Student class to be stored into the array of Student objects.
Joanne
