why do I get the error illegal start of expression in my code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • babs115
    New Member
    • Jun 2015
    • 18

    why do I get the error illegal start of expression in my code

    please help

    Code:
    import java.util.*;
    
    
    
    
    public class Vehicle
    {
        
      maxSpeed ms;
      mark m;
      regNumber rn;
       
      public static void main(String []args)
      {  
       int maxSpeed;
       String mark;
       String regNumber;
        
      public Vehicle()
       {
           int maxSpeed = new maxSpeed();
           String mark = new mark();
           String regNumber = new regNumber();
        }
        
        public Vehicle(int maxSpeed, String mark, String regNumber)
        {
           this.maxSpeed=maxSpeed;
           this.mark=mark;
           this.regNumber=regNumber;
        }
        
        public void setmaxSpeed(int speed)
        {
            this.maxSpeed=maxSpeed;
        }
        
        public int getmaxSpeed()
        {
            return maxSpeed;
        }
        
        public void setmark(String mark)
        {
            this.mark=mark;
        }
        
        public String getmark()
        {
            return mark;
        }
        
        public void setregNumber(String regNumber)
        {
            this.regNumber=regNumber;
        }
        
        public String getregNumber()
        {
            return regNumber;
        }
    }
    Last edited by zmbd; Jan 2 '16, 06:11 PM. Reason: babs115: normally, threads consisting of simply posted code without any indication of the work done for basic trouble shooting are closed without answer. Please see the FAQ
  • aswal
    New Member
    • Aug 2013
    • 38

    #2
    Errors:
    • Closing brace of main method is missing


    There are many others also but for that you have to document the code well ans tell about the realated classes.

    Comment

    Working...