ITEC 2610 Study Guide - Final Guide: Abstract Data Type, Init

87 views10 pages
Ambassador badge icon
22 Oct 2021
Course
Professor

Document Summary

Part a1: 1f 2t 3f 4f 5t 6t 7t 8f 9t 10t. Part a2: 1a 2d 3d 4e 5a 6d 7a 8d 9a 10c. B1) difference between instance fields and local variables. Where it is declared: local variables are declared in a method, constructor or block; instance fields are declared in a class, but outside a method. Scope: local variables exist while the block where they were created is executed; instance variables exist as long as the object they belong to exists. B2) difference between a class and an object. A class is like an abstract data type, and describes the attributes and behavior of a group of similar objects. An object is an instance of a class. Part c class car { protected string model; protected int year, price; public car (string mod, int yr, int pri) { model=mod; year=yr; price=pri; 5 public int getprice() { return price; public string getcolor() { return ""; public string tostring() {