CS 187SL Study Guide - Midterm Guide: Linked List, Type System, Class Variable

49 views13 pages
15 Feb 2016
Course
Professor

Document Summary

Topics included: classes, linked lists, big o, stacks, generics, exceptions, linked stacks. A java class defines the structure of an object or a set of objects. A class defines variables (data) and methods (actions) that determine the behavior of an object. Example: public class date private int year; private int month; private int day; //constructor public date(int newmonth, int newday, int newyear) month = newmonth; year = newyear; day = newday; //observers public int getyear() return year; public int getmonth() return month; public int getday() return day; public string tostring() return (month + / + day + year ); The date class provides an example of how a class would be structured. The instance variables are date, month and year. The methods, or actions of this class are getyear(), getmonth(), getday() and tostring(): objects. They can contain and manipulate data and are created using the constructor of the objects class.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents