Define Mobile Class and Constructors - Java Quiz Question


Define a Mobile class with member variables model, numberOfSims, memory and hasCamera. There respective data types are String, int, double and boolean. Also define a constructor which initializes these variables using the passed parameters.



class MobileTester
{
    public static void main(String s[])
    {
        Mobile mobile = new Mobile("Samsung Wave", 2, 1024.0, true);
        
        System.out.print(mobile.model + " has " + mobile.numberOfSims + " sims and has a memory of " + mobile.memory + " MB.");
        System.out.println(mobile.hasCamera ? " It has a camera." : " It has no camera.");

    }



}
class Mobile
{
}