Note that there are some explanatory texts on larger screens.

plurals
  1. POJava error, cannot find symbol - class string
    primarykey
    data
    text
    <p>I am trying to get my code to create the new constructor objects which I require to create a mobile phone object. I have tried naming the constuctor fields to create the object.</p> <p>UPDATE: I have amended <code>string</code> to be <code>String</code>, however now when I update it I get the error:</p> <pre><code>error: constructor Mobile(java.lang.String,int,int,java.lang.String,int,java.lang.String) is already defined in class Mobile </code></pre> <p>This error comes up at the bottom of the page at:</p> <pre><code>public Mobile(String MobilephoneType, int Mobilescreensize, int Mobilememorycardcapacity, String newserviceprovider, int Mobilecameraresolution, String MobileGPS) { </code></pre> <p>What does this error mean?</p> <p>The code so far:</p> <pre><code>/** * to write a simple java class Mobile that models a mobile phone. * * @author (Lewis Burte-Clarke) * @version (14/10/13) */ public class Mobile { // type of phone private String phonetype; // size of screen in inches private int screensize; // menory card capacity private int memorycardcapacity; // name of present service provider private String serviceprovider; // type of contract with service provider private int typeofcontract; // camera resolution in megapixels private int cameraresolution; // the percentage of charge left on the phone private int checkcharge; // wether the phone has GPS or not private String GPS; // instance variables - replace the example below with your own private int x; // The constructor method public Mobile(String mobilePhoneType, int mobileScreenSize, int mobileMemoryCardCapacity, String newserviceprovider, int mobileCameraResolution, String mobileGPS) { this.phonetype = mobilePhonetype; this.screensize = mobileScreensize; this.memorycardcapacity = mobileMemoryCardCapacity; this.cameraresolution = mobileCameraResolution; this.GPS = mobileGPS; // you do not use this ones during instantiation,you can remove them if you do not need or assign them some default values this.serviceprovider = newserviceprovider; this.typeofcontract = 12; this.checkcharge = checkcharge; } // A method to display the state of the object to the screen public void displayMobileDetails() { System.out.println("phonetype: " + phonetype); System.out.println("screensize: " + screensize); System.out.println("memorycardcapacity: " + memorycardcapacity); System.out.println("cameraresolution: " + cameraresolution); System.out.println("GPS: " + GPS); System.out.println("serviceprovider: " + serviceprovider); System.out.println("typeofcontract: " + typeofcontract); } public Mobile(String MobilephoneType, int Mobilescreensize, int Mobilememorycardcapacity, String newserviceprovider, int Mobilecameraresolution, String MobileGPS) { this.phonetype = Mobilephonetype; this.screensize = 3; this.memorycardcapacity = 4; this.cameraresolution = 8; this.GPS = GPS; this.serviceprovider = newserviceprovider; this.typeofcontract = 12; this.checkcharge = checkcharge; } } class mymobile { public static void main(String[] args) { Mobile Samsung = new Mobile("Samsung", "3", "4", "8", "GPS"); Mobile Blackberry = new Mobile("Blackberry", "3.", "4", "8", "GPS"); Samsung.displayMobileDetails(); Blackberry.displayMobileDetails(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload