Hello again. So lately i've been learning java, and now i want to make a program but in this program i need to do something like in pascal record(i want to make an array, and in every element of this array i have a string and an int). I heared that in java is called class, but i can't find anywhere explained very clearly.
freakvista
0
Light Poster
Recommended Answers
Jump to PostSomething like this?
public class ComponentTest{ public static void main(String[] args){ Component[] components = new Component[]{new Component("motherboard", 1234567), new Component("processor", 2345678), new Component("hard disk", 987654)}; for(Component c : components){ c.print(); } } private static class Component{ private String name; private long serialNumber; public Component(String name, long serialNumber){ …
All 2 Replies
peter_budo
2,532
Code tags enforcer
Team Colleague
Featured Poster
dmanw100
36
Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.