How to find an object in arraylist by one of it's element and print it?
<p>I am developing a console application where I can register items. Each item has 3 properties serial number, model, year.
I have 3 classes Laptop, Laptops(arraylist) and Office to run the application.
So far I have managed to find the object itself by index number, but i need to list all objects with the property typed in.</p>

<p>This is how I ask user to choose the option</p>

<pre><code>Laptops inHouse = new Laptops();
model = Console.askModel("Enter Model : ");
inHouse.findModel(model);
break;
</code></pre>

<p>That is the find method in Laptops class</p>

<pre><code>public void findModel(String aModel)
{
    int arraySize = laptops.size();
    for(int i=0; i&lt;arraySize; i++) {
        if (laptops.get(i).getModel() == aModel) {
            System.out.println(laptops.get(i));
        }
    }       
}
</code></pre>

<p>this is the askModel method in Console class.</p>

<pre><code>public static String askModel(String aModel)
{
    System.out.println(aModel);
    String model = askString("Enter the model: ");
    return model;
}
</code></pre>

<p>Additionally, I am quite new to java, I understand the concept but still struggling on many thing so If I forgot to post a code which is needed to solve the problem I am sorry in advnace.</p>
