1 / 12

Introduction to Object-Oriented Programming Concepts using Java

This lecture presents a foundational understanding of object-oriented programming, focusing on techniques such as method calls, local variables, and instance variables. It covers essential Java constructs, including object creation, variable referencing, and class interactions. Through practical examples, participants will learn about arrays, constructors, and managing object states, all while building a mini-golf application. The session is designed for beginners to grasp the core principles of coding in Java while enhancing their problem-solving skills through hands-on exercises.

jera
Download Presentation

Introduction to Object-Oriented Programming Concepts using Java

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. Föreläsning 10 • Minnesbilder

  2. Minnesbilder steg 1 char char ch; int[] vek; Bil bilen; ch int[] vek Bil bilen

  3. Minnesbilder steg 2metodanrop&lokala variabler objekt&instansvariabler ch = ’3’; int[] vek = new int[4]; Bil bilen = new Bil(); char ch int[4]-objekt ’3’ vek Bil-objekt pris färg double bilen 0 String null

  4. Minnesbilder steg 3 metodanrop&lokala var. objekt&instansvar. vek[0] = 4; vek[1] = 3; vek[2] = 0; vek[3] = 7; int[] int[4]-objekt vek 4 3 0 7

  5. Minnesbilder steg 4 public static final int OTUR = 13; klasser&klassvar. metodanrop&lokala var. objekt&instansvar. int int[] int[4]-objekt OTUR vek 13 4 3 0 7

  6. Referenser, exempelsteg1 metodanrop&lokala var. objekt&instansvar. Punkt punkt1 = new Punkt(5, 3); Punkt punkt2; punkt2 = punkt1; punkt1 punkt2 Punkt Punkt-objekt int x y 5 Punkt int 3

  7. Referenser, exempelsteg2 metodanrop&lokala var. objekt&instansvar. punkt1 = null; punkt2.nollställAllt(); punkt1 punkt2 Punkt Punkt-objekt null int x y 0 Punkt int 0

  8. Referenser, exempelsteg3 metodanrop&lokala var. objekt&instansvar. punkt2 = null; punkt1 punkt2 Punkt Punkt-objekt null int x y 0 Punkt int null 0

  9. Person Person Person 0 1 2 null null Minigolf5:1 Person[] spelare; Person[]-objekt spelare null spelare = new Person[3]; Person[] Person[3]-objekt spelare null

  10. Person Person Person 0 1 2 null null Minigolf5:2 spelare[0] = new Person("Linda",5); spelare[0].spela(); Person[] Person[3]-objekt spelare Person-objekt int nivå 8 String String-objekt namn Linda int[] int[14]-objekt protokoll 4 3 1 7 4 3 2 7 4 3 3 8 4 3

More Related