What's new

Closed Hi guys, paturo naman sa java language o ano pa :(

Status
Not open for further replies.

imdrick1

Honorary Poster
Joined
Nov 20, 2016
Posts
150
Reaction
27
Points
130
no idea talaga ako kung ano tama ilagay jan.

salamat kung sino mag reply :(

upload_2019-1-14_23-4-40.png
 

Attachments

Since its java, how about iterate through the array of objects?
You set those values you are asking about each student with an instance of the class Student. That's the part you are not doing in the code above.
 
hindi ko alam kung anong tanong mo jan sir. pero at a glance, there is something wrong with your code. pero yun nga, your question is vague and unclear.
 
Since its java, how about iterate through the array of objects?
You set those values you are asking about each student with an instance of the class Student. That's the part you are not doing in the code above.
Pano po e code yung array of objects sir?
 
hindi ko alam kung anong tanong mo jan sir. pero at a glance, there is something wrong with your code. pero yun nga, your question is vague and unclear.
Ang tanong ko sir, pano po e array yung class po? Triny ko in different ways pero no idea tlaga
 
Ang tanong ko sir, pano po e array yung class po? Triny ko in different ways pero no idea tlaga

Di ko ma gets sir. Array is different entity into Classes. Array is a Data Structure used to store data of the same data types. while on the other hand, Class is an Object itself. it may consists some members like variables, methods, properties, etc. Classes can have array inside as its member. So yung tanong mong paano e array yung class? parang ang gulo po.

kasi based sa image ng code mo sa taas, yung ininput mo sa variable mo na xx is pinarse mo sya as int tapos nilagay mo sya sa variable mo na x tapos ginawa mo syang dynamic na array element length sa arrStudent mo na variable(which is an array) then sa baba na code parang gusto mong maglagay ng data sa bawat array element nung arrStudent mo na array. pero at the same time parang napansin ko din na parang gusto mong mag instantiate ng Student class mo as arrStudent which is I think hindi possible(as far as I know in Java).

to make an instance of the Student Class, it should be something like:
Student stud = new Student();

am I missing something here?
 
Last edited:
I think ang gusto niya mangyare is mag generate ng madaming classes based dun sa different iteration which is not gonna work. Array can only hold data structure types like int, double, String, Object, etc etc. Class can't be made, unless it is Interface like JProgressBar, JButton etc.
 
I think ang gusto niya mangyare is mag generate ng madaming classes based dun sa different iteration which is not gonna work. Array can only hold data structure types like int, double, String, Object, etc etc. Class can't be made, unless it is Interface like JProgressBar, JButton etc.

to generate ng maraming classes of the same based class? for what po kaya when you can always instantiate naman a class to different areas within the same namespace. kung naman gusto nya mag extend ng class he can always use partial classes without direct modification of the actual based class. di ko lang talaga ma gets pero syempre lahat tayo dumaan sa confusion so I assume na di nya lan ma express yung gusto nyang sabihin at paliwanag.
 
Pano po e code yung array of objects sir?
sample ganito:

var person = [
{name: "John Doe", age: 24, address: "Malabon City"},
{name: "Jane Die", age: 20, address: "Quezon City"},
{name: "John Dave", age: 14, address: "Manila City"}

];
 
sample ganito:

var person = [
{name: "John Doe", age: 24, address: "Malabon City"},
{name: "Jane Die", age: 20, address: "Quezon City"},
{name: "John Dave", age: 14, address: "Manila City"}

];
sa loob ng array, may mga objects
 
Alright, gets ko na ibig nyang sabihin. I write in C# and I found something like this that works.

class student
{
public int studid { get; set; }
public string name { get; set; }
public int age { get; set; }
}

student[] stud = {new student(){studid=1, name="Arvin Aquio", age=32},
new student(){studid=2, name="Juan Tamad", age=30},
new student(){studid=3, name="Maria Dela Cruz", age=22},
new student(){studid=4, name="Peter Parker", age=24},
new student(){studid=5, name="Joel Manulat", age=36}};

then the data inside each element can be iterated using foreach or for loops or any loops.
 
Thabk you po sa lahat nag reply. I knew the answer, di dapat tlga yun e array hehehe isang statement para sa lahat sa e store kung anumang input, d kailangan ng lima hehehe
 
Status
Not open for further replies.
Back
Top