Problem Solving #3: JVM ICS201-071. 2 Outline Review of Key Topics Review of Key Topics Problem 1 Problem 1 Problem 2 Problem 2 Problem 3 Problem 3 Problem.

Slides:



Advertisements
Similar presentations
Introduction to classes Sangeetha Parthasarathy 06/11/2001.
Advertisements

OO Programming in Java Objectives for today: Overriding the toString() method Polymorphism & Dynamic Binding Interfaces Packages and Class Path.
Computer Programming Lab(7).
INHERITANCE BASICS Reusability is achieved by INHERITANCE
Problem Solving 5 Using Java API for Searching and Sorting Applications ICS-201 Introduction to Computing II Semester 071.
 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Java Virtual Machine (JVM). Lecture Objectives Learn about the Java Virtual Machine (JVM) Understand the functionalities of the class loader subsystem.
OBJECT-ORIENTED PROGRAMMING CONCEPTS (Review). What is an Object? What is an Object? Objects have states and behaviors. Example: A dog has states - color,
JVM-1 Java Virtual Machine Reading Assignment: Chapter 1: All Chapter 3: Sections.
JVM-1 Java Virtual Machine Reading Assignment: Chapter 1: All Chapter 3: Sections.
Lecture 4: Objects and Classes Classes Objects Data fields (instance variables) Methods –Instance methods –Static methods –Constructors But first…
Java Virtual Machine (JVM). Lecture Objectives Learn about the Java Virtual Machine (JVM) Understand the functionalities of the class loader subsystem.
Reflection (Reflexion in British English ) Mo Alkhafaji.
Java Programming, 3e Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
03G-1 Reflection In Java For every loaded class, the Java Runtime Environment (JRE) maintains an associated Class object The Class object “ reflects ”
Unit 061 Java Virtual Machine (JVM) What is Java Virtual Machine? The Class Loader Subsystem Linking oVerification oPreparation oResolution Class Initialization.
JavaScript with Input & Output Step 1: Use tags JavaScript Template.
Interfaces besides classes, Java recognizes another type, an interface interface is used to completely shield off all implementation from the programmer.
Introducing JavaBeans Lesson 2A / Slide 1 of 30 JDBC and JavaBeans Pre-assessment Questions 1.Which of the given symbols is used as a placeholder for PreparedStatement.
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
CS0007: Introduction to Computer Programming File IO and Recursion.
Introduction to Object Oriented Design. Topics Designing Your Own Classes Attributes and Behaviors Class Diagrams.
CSM-Java Programming-I Spring,2005 Objects and Classes Overview Lesson - 1.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
The Reflection Lucielle Mendez Antonio Bologna.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
POS 406 Java Technology And Beginning Java Code
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
Back Tracking Project Due August 11, 1999 N-queens: –A classic puzzle for chess buffs is the N- Queens problem. Simply stated: is it possible to place.
Creating Projects in JCreator Computer Science 40S.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
© Keren Kalif Advanced Java Topics Written by Keren Kalif, Edited by Liron Blecher.
Data Structures Using Java1 Chapter 2 Inheritance and Exception Handling.
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Copyright © Mohamed Nuzrath Java Programming :: Syllabus & Chapters :: Prepared & Presented By :: Mohamed Nuzrath [ Major In Programming ] NCC Programme.
1. 2  Classes are not just containers for methods ◦ Virtually all are classes ◦ Blueprint/Cookie Cutter/Recipe ◦ Objects – instance of the class (new)
M1G Introduction to Programming 2 5. Completing the program.
1 The finalize, clone, and getClass Methods  The finalize method is invoked by the garbage collector on an object when the object becomes garbage.  The.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
Creating a Java Application and Applet
 2005 Pearson Education, Inc. All rights reserved. 1 Introduction to Classes and Objects.
Introduction to Objects and Encapsulation Computer Science 4 Mr. Gerb Reference: Objective: Understand Encapsulation and abstract data types.
Terms and Rules II Professor Evan Korth New York University (All rights reserved)
CPSC 233 Tutorial 5 February 2 th /3 th, Java Loop Statements A portion of a program that repeats a statement or a group of statements is called.
Object and Classes อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 3.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
Creating Java Applications (Software Development Life Cycle) 1. specify the problem requirements - clarify 2. analyze the problem - Input? Processes? Output.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
More Sophisticated Behavior
Objects as a programming concept
3 Introduction to Classes and Objects.
Objects as a programming concept
CSE 413, Autumn 2002 Programming Languages
Programming without BlueJ Week 12
EE 422C Java Reflection re·flec·tion rəˈflekSH(ə)n/ noun
Multi-Dispatch in the Java™ Virtual Machine
Exception Handling Chapter 9.
CSC 113: Computer programming II
L3. Necessary Java Programming Techniques
L3. Necessary Java Programming Techniques
CS18000: Problem Solving and Object-Oriented Programming
Generic Classes and Methods
Class Examples.
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
F II 8. More on Inheritance Objectives
Presentation transcript:

Problem Solving #3: JVM ICS

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

Form Groups of 3 Students and Work on the Following Problem

4 Review of Main Topics JVM 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. 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. 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, 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 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