CS2_04A_Whatsanobject

CS2_04A_Whatsanobject - CS2 Module 4A Category: Elements of...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
CS2 Module 4A Category: Elements of Java Topic: What's an object? Objectives Second look at elements of Java
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS 2 Introduction to Object Oriented Programming Module 4A Elements of Java What's an Object?
Background image of page 2
Object Oriented Programming OOP is all about programming using something called an object We'll get much more deeply into this topic later (after some basic stuff) But just in case you can't wait. ..
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Previously. .. public class HelloWorld { public void greet() { System.out.println("Hello World!"); } public static void main(String argv[]) { HelloWorld hw = new HelloWorld(); hw.greet(); } }
Background image of page 4
A Class class Greeter { String greeting; public Greeter(String newGreeting) { greeting = newGreeting; } public void greet(String name) { System.out.println(greeting + ", " + name); } } A class will be used to define how objects made from this class will operate A class will be used to define how objects made from this class will operate
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Field class Greeter { String greeting; public Greeter(String newGreeting) {
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

CS2_04A_Whatsanobject - CS2 Module 4A Category: Elements of...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online