Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Row{
- private int id;
- private String nazwa;
- private String typ;
- private String rok;
- private int cena;
- Row(int id, String nazwa, String typ, String rok, int cena){
- this.id=id;
- this.nazwa=nazwa;
- this.typ=typ;
- this.rok=rok;
- this.cena=cena;
- }
- public String toString(){
- return "Gra nr " + id + ": " + typ + " " + nazwa + " " + rok + " cena: " + cena + "\n";
- }
- }
- public class Main {
- public static void main(String[] args){
- Row[] baza = new Row[5];
- baza[0] = new Row(0, "Nazwa1", "Typ1", "2001", 20);
- baza[1] = new Row(1, "Nazwa2", "typ2", "2004", 10);
- baza[2] = new Row(2, "Nazwa3", "typ3", "2010", 30);
- for(int i = 0; i<3; i++){
- System.out.println(baza[i].toString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement