title: Using .jar files in the main function
body: <p>Once I import .jar file to the main function. I have done everything correctly : (Right
  clickproject-­‐>Properties-­‐>JavaBuildPath-­‐>Libraries-­‐>AddJARs). </p>
  
  <p>Now if I want to start using methods and variables from a class that's in the .jar file. </p>
  
  <p>In the main function, do I just declare an object of the class type and start using methods from the class?</p>
  
  <p>I tried that and it keeps giving me the <code>error: "Syntax error on token ";", @ expected"</code></p>
  
  <pre><code>package abcd;
  
  import util.Car;
  
  public class Showroom {
  
     Car firstCar = new Car("BMW"); //overloaded constructor 
  
     Car secondCar = new Car(); //default constructor is empty 
  
     secondCar.setName("Lexus"); //setName is a method in the Car class but I get the above error for using this. 
  
  }
  </code></pre>
  
  <p>I know it has a very easy solution but can you please explain what and why?</p>