Search:

Type: Posts; User: mihal

Search: Search took 0.36 seconds.

  1. Replies
    14
    Views
    1,027

    Re: acessing ArrayList

    :) ok here the code

    import java.util.ArrayList;
    import java.util.List;


    public class Hotel {
    private static String name;
    private static String address;
    static List[] floors=new...
  2. Replies
    14
    Views
    1,027

    Re: acessing ArrayList

    i solved the null pointer exceptions but now it seems it isnt working properly
    the if statement if ((floors[i].equals(r)) was giving me null pointer so i changed it with if ((floors.equals(r)) where...
  3. Replies
    14
    Views
    1,027

    Re: acessing ArrayList

    Actually no, :( i added an main method and tryed to add a room but it giving me errors


    public static void main(String[]args)throws Exception{
    Hotel hotel=new Hotel("Hilton","Brodway 1001");...
  4. Replies
    14
    Views
    1,027

    Re: acessing ArrayList

    What if I declare the roomPerFloor1,2,3 up in the beginning and initialize them in the constructor of hotel, i assume the constructor will be called only once and maybe replace switch with if but i...
  5. Replies
    14
    Views
    1,027

    Re: acessing ArrayList

    u mean ArrayList<Type> but it cannot be int, right just String and i need to cast it right?


    So how do i solve this maybe add second inner for loop that counts rooms or
    i solve it somehow with...
  6. Replies
    14
    Views
    1,027

    Re: acessing ArrayList

    Sorry actually im trying to compare them, so i found out i have to use .equals statement so it will be if((floors[i].equals(floor)) &&(...)&&(...) think is good like this

    i get it. It can be set...
  7. Replies
    14
    Views
    1,027

    Re: acessing ArrayList

    I wanted to set floors[i] to floor but it giving me error
    yeah i know they have no value but i do that becouse if i set them to 0 they gonna reset every time i exit the for loop, so i think i need...
  8. Replies
    14
    Views
    1,027

    acessing ArrayList

    ok i need to make an method that adds a room on the specific floor
    on each floor there can be maxRoomPerFloor rooms
    if on floor are no rooms return false on other hand return true
    @param floor is...
Results 1 to 8 of 8