1 / 8

Problem Solving #4: JVM

Problem Solving #4: JVM. ICS201-081. Outline. Review of Key Topics Problem 1 Problem 2 Problem 3 Problem 4. Form Groups of 3 Students and Work on the Following Problem. Review of Main Topics. JVM Reflection At runtime, the Java programmers can inspect various information including

awetmore
Download Presentation

Problem Solving #4: JVM

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Problem Solving #4: JVM ICS201-081

  2. Outline • Review of Key Topics • Problem 1 • Problem 2 • Problem 3 • Problem 4

  3. Form Groups of 3 Students and Work on the Following Problem

  4. Review of Main Topics • JVM • Reflection • At runtime, the Java programmers can inspect various information including • name of the class of a given object • name of the superclass of that class • names of interfaces that class • methods that belong to that class • etc

  5. Problem 1 • Write a program to show that each loaded type has only one instance of java.lang.Class associated with it, irrespective of how many times it is used in a class. Solution: Show Source Code Then run it in JCreator to check the output

  6. Problem 2 • Write a program to create an object of type String. Then print out the type of this object, its superclass, its package, all constructors, all methods, and all fields defined in this type. Solution: Show Source Code Then run it in JCreator to check the output

  7. Problem 3 • Modify the solution for problem 2 to prompt the user to type a class or an interface full name then print out whether the entered name is a class or interface, • All other information as in problem 2 Solution: Show Source Code Then run it in JCreator to check the output

  8. Problem 4 • Modify the solution for problem 3 to print out all the classes on the path starting from the entered class name till the Object class in addition to all as in problem 2

More Related