Programming and Problem Solving with Java

(やまだぃちぅ) #1
723


  1. a.public classSomeClass
    b.public static voidsomeMethod()
    c. static intsomeMethod()
    d.private static intsomeMethod()
    e.protected static charsomeMethod()
    6.public classSomeClass
    {
    intvar; // Class member
    final intCONST= 3; // Class member CONST
    public voidsomeMethod(intparam)
    {
    intvar; // Local variable
    var = param * CONST;
    final intconst = 10 ;
    var = 5 ; // Local variable
    System.out.println(""+ this.var); // Class member
    }
    }
    8.The code segment is not correct because the signatures are not distinct.
    public intsomeMethod() // someMethod
    public voidsomeMethod() // someMethod
    public doublesomeMethod() // someMethod
    public doublesomeMethod(inta) // someMethod, int
    public doublesomeMethod(String a) // someMethod, String
    public doublesomeMethod(inta, intb) // someMethod, int, int


Chapter 8 Exam Preparation Exercises


2.Cost is
300
Price is 30Cost is 300
Grade A costs
300


  1. a. 26
    b.reparation
    c. 0
    9.No. We just instantiate a JPanelobject.
    13.Nothing appears on the screen.

Free download pdf