e used only from the point at U tie method declaration. An instance variable is declared in a , Vul hot in the body of any of the class's methods. Also, instance variables are accessible to all methods of the class. (We'll see an exception to this in Chapter 8.) 3.4 A parameter represents additional information that a method requires to perform its task. Each parameter required by a method is specified in the method's declaration. An argument is the actual value for a method parameter. When a method is called, the argument values are passed to the corresponding parameters of the method so that it can perform its task. Exercises 3.5 (Keyword new) What's the purpose of keyword new? Explain what happens when you use it. 3.6 (Default Constructors) A class declares a constructor that takes two parameters. How would you create an instance of the class with no parameters? 3.7 (Instance Variables) Explain the purpose of an instance variable. 3.8 (Using Classes without Importing Them) Most classes need to be imported before they can be used in an app. Why is every app allowed to use classes System and String without first importing them? (3.9 (Using a Class without Importing 11) Explain how a program could use class Scanner with- out importing it. 3.10 set and get Methods) Explain the disadvantage of creating a class that has no set and get methods for an instance variable. 3.1D (Modified Account Class) Modify class Account (Fig. 3.8) to provide a method called with draw that withdraws money from an Account. Ensure that the withdrawal amount does not exceed the Account's balance. If it does, the balance should be left unchanged and the method should print a message indicating "Withdrawal amount exceeded account balance." Modify class Account Test (Fig. 3.9) to test method withdraw. 3.12 (Class Petrol Purchase) Create a class called Petrol Purchase to represent information about the petrol you purchase. The class should include five pieces of information in the form of . (3.9 (Using a Class without Importing It) Explain how a program could use class Scanner with- out importing it. 3.10 set and get Methods) Explain the disadvantage of creating a class that has no set and get methodo fi ablo e used only from the point at U tie method declaration. An instance variable is declared in a , Vul hot in the body of any of the class's methods. Also, instance variables are accessible to all methods of the class. (We'll see an exception to this in Chapter 8.) 3.4 A parameter represents additional information that a method requires to perform its task. Each parameter required by a method is specified in the method's declaration. An argument is the actual value for a method parameter. When a method is called, the argument values are passed to the corresponding parameters of the method so that it can perform its task. Exercises 3.5 (Keyword new) What's the purpose of keyword new? Explain what happens when you use it. 3.6 (Default Constructors) A class declares a constructor that takes two parameters. How would you create an instance of the class with no parameters? 3.7 (Instance Variables) Explain the purpose of an instance variable. 3.8 (Using Classes without Importing Them) Most classes need to be imported before they can be used in an app. Why is every app allowed to use classes System and String without first importing them? (3.9 (Using a Class without Importing 11) Explain how a program could use class Scanner with- out importing it. 3.10 set and get Methods) Explain the disadvantage of creating a class that has no set and get methods for an instance variable. 3.1D (Modified Account Class) Modify class Account (Fig. 3.8) to provide a method called with draw that withdraws money from an Account. Ensure that the withdrawal amount does not exceed the Account's balance. If it does, the balance should be left unchanged and the method should print a message indicating "Withdrawal amount exceeded account balance." Modify class Account Test (Fig. 3.9) to test method withdraw. 3.12 (Class Petrol Purchase) Create a class called Petrol Purchase to represent information about the petrol you purchase. The class should include five pieces of information in the form of . (3.9 (Using a Class without Importing It) Explain how a program could use class Scanner with- out importing it. 3.10 set and get Methods) Explain the disadvantage of creating a class that has no set and get methodo fi ablo