How is Java both "compiled" and "interpreted"? ---------------------------------------------------------------------- What is the static type of freakshow? The dynamic type? Object freakshow = new Integer(); What is wrong with the following, given Integer defines a method intValue() with return type int? int n = freakshow.intValue(); ---------------------------------------------------------------------- Most methods you use in Java are instance methods. Give an example of a situation in which static/class methods must be used. In what ways are constructors similar to instance methods? In what way are they similar to static/class methods? ---------------------------------------------------------------------- What are the advantages and disadvantages of an interpreter vs. compiler? ---------------------------------------------------------------------- Which one of these happens ONLY in derived classes? overloading overriding neither both True or False: Both overloading and overriding require methods to have the same return type. Which of these is a form of polymorphism? overloading overriding neither both ---------------------------------------------------------------------- (AA: Ting and Alison) In Java, is there a way to store primitive type values in heap memory? In Java, is there a way to store object instances in stack memory? ---------------------------------------------------------------------- Suppose both Ball and subclass ColorBall define instance method bounce() and static/class method getClassName(). What methods are called by the code below and which calls are dynamically dispatched? Ball ballA = new Ball(); Ball ballB = new ColorBall(); ballA.bounce(); ballB.bounce(); ballA.getClassName(); ballB.getClassName(); Is it possible to catch dynamic type errors at compile time? Is Java a statically typed language? ---------------------------------------------------------------------- How does the compiler determine whether a method call will be dispatched dynamically? When would one want to use dynamic dispatching and when would one want to use static dispatching? ---------------------------------------------------------------------- pass by value vs. pass by reference Which model does Java use to pass variable values to methods? Which model does Miranda use to pass variable values to functions? ---------------------------------------------------------------------- (AB: Bill, Hamed, Ryan) Does a private method in a base class get inherited by the derived class? How about a protected method? In Java, what is the difference between public, protected, private and package visibility? ---------------------------------------------------------------------- Write code showing one example each of overriding a function and overloading a function. ---------------------------------------------------------------------- Primitive type values are passed by __________, while class type values are passed by __________. ---------------------------------------------------------------------- When calling an instance method, the Java virtual machine uses __________ dispatching. Java uses static dispatching when calling this kind of method. What is it? ---------------------------------------------------------------------- (AB: Tessa and Adrienne) How do you call a static/class method? A. Ball b = new Ball(); b.classMethod(); B. Ball.classMethod(); C. classMethod(); ---------------------------------------------------------------------- Ball b = new Ball(); Ball c = b; How many Ball instances are allocated by the lines above?