Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. solve the error

solve the error

Scheduled Pinned Locked Moved Java
help
7 Posts 6 Posters 11 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_15667242
    wrote on last edited by
    #1

    public class student{
    private int ID;
    private String Name;
    Student class constructor
    student(int id, String name){
    this.ID = id;
    this.Name = name;}
    public int getid(){
    return this.ID;}
    public String Getname(){
    return this.Name;}
    public void SETid(int i){
    this.ID = i;}
    public void sETNAme(String n){
    this.Name=n;}
    method to display data
    public void display() {
    System.out.println("Student id is: " + id + " "
    + "and Student name is: "

    • Name;);
      System.out.println();
      }}
    Richard DeemingR L S 3 Replies Last reply
    0
    • M Member_15667242

      public class student{
      private int ID;
      private String Name;
      Student class constructor
      student(int id, String name){
      this.ID = id;
      this.Name = name;}
      public int getid(){
      return this.ID;}
      public String Getname(){
      return this.Name;}
      public void SETid(int i){
      this.ID = i;}
      public void sETNAme(String n){
      this.Name=n;}
      method to display data
      public void display() {
      System.out.println("Student id is: " + id + " "
      + "and Student name is: "

      • Name;);
        System.out.println();
        }}
      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      No. Even if you'd asked nicely, you haven't bothered to tell us what "the error" is. Dumping your code without explanation and demanding that someone "solve the error" is a great way to alienate people, and ensure nobody wants to help you.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      • M Member_15667242

        public class student{
        private int ID;
        private String Name;
        Student class constructor
        student(int id, String name){
        this.ID = id;
        this.Name = name;}
        public int getid(){
        return this.ID;}
        public String Getname(){
        return this.Name;}
        public void SETid(int i){
        this.ID = i;}
        public void sETNAme(String n){
        this.Name=n;}
        method to display data
        public void display() {
        System.out.println("Student id is: " + id + " "
        + "and Student name is: "

        • Name;);
          System.out.println();
          }}
        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Let's start by formatting the code and adding ;line numbers so it is actually readable. You can now clearly see that at the very least you have invalid lines at lines numbers 5 and 22. I assume these are supposed to be comment lines so require a "//" at the beginning. You also have mixed capitalisation on your setters and getters. So start by fixing those and see what happens.

        public class student{
        private int ID;
        private String Name;

        Student class constructor
        student(int id, String name){
            this.ID = id;
            this.Name = name;
        }
        public int getid(){
            return this.ID;
        }
        public String Getname(){
            return this.Name;
        }
        public void SETid(int i){
            this.ID = i;
        }
        public void sETNAme(String n){
            this.Name=n;
        }
        method to display data
        public void display() {
            System.out.println("Student id is: " + id + " "
                + "and Student name is: "
                + Name;
            );
            System.out.println();
        }
        

        }

        1 Reply Last reply
        0
        • M Member_15667242

          public class student{
          private int ID;
          private String Name;
          Student class constructor
          student(int id, String name){
          this.ID = id;
          this.Name = name;}
          public int getid(){
          return this.ID;}
          public String Getname(){
          return this.Name;}
          public void SETid(int i){
          this.ID = i;}
          public void sETNAme(String n){
          this.Name=n;}
          method to display data
          public void display() {
          System.out.println("Student id is: " + id + " "
          + "and Student name is: "

          • Name;);
            System.out.println();
            }}
          S Offline
          S Offline
          Sakshi Jain 2022
          wrote on last edited by
          #4

          You forget to add // on commenting lines that is in line number 5 and 22

          public class student{
          private int ID;
          private String Name;

          //Student class constructor
          student(int id, String name){
              this.ID = id;
              this.Name = name;
          }
          public int getid(){
              return this.ID;
          }
          public String Getname(){
              return this.Name;
          }
          public void SETid(int i){
              this.ID = i;
          }
          public void sETNAme(String n){
              this.Name=n;
          }
          // method to display data
          public void display() {
              System.out.println("Student id is: " + id + " "
                  + "and Student name is: "
                  + Name;
              );
              System.out.println();
          }
          

          }

          L 1 Reply Last reply
          0
          • S Sakshi Jain 2022

            You forget to add // on commenting lines that is in line number 5 and 22

            public class student{
            private int ID;
            private String Name;

            //Student class constructor
            student(int id, String name){
                this.ID = id;
                this.Name = name;
            }
            public int getid(){
                return this.ID;
            }
            public String Getname(){
                return this.Name;
            }
            public void SETid(int i){
                this.ID = i;
            }
            public void sETNAme(String n){
                this.Name=n;
            }
            // method to display data
            public void display() {
                System.out.println("Student id is: " + id + " "
                    + "and Student name is: "
                    + Name;
                );
                System.out.println();
            }
            

            }

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            See my answer of 9th June above.

            P 1 Reply Last reply
            0
            • L Lost User

              See my answer of 9th June above.

              P Offline
              P Offline
              Peter_in_2780
              wrote on last edited by
              #6

              He already did, when he cut'n'pasted it

              Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

              C 1 Reply Last reply
              0
              • P Peter_in_2780

                He already did, when he cut'n'pasted it

                Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

                C Offline
                C Offline
                Custom Neon Sign
                wrote on last edited by
                #7

                Good Answer.[

                Custom Neon Sign

                ](https://createneon.com/create-your-own-neon-sign/)

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups