Define Mobile Class - 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.



class MobileTester
{
    public static void main(String s[])
    {
        Mobile mobile = new Mobile();
        mobile.model = "Nokia 2430";
        mobile.numberOfSims = 1;
        mobile.memory = 512.0;
        mobile.hasCamera = false;
        
        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
{
}