CS 121 Lecture Notes - Lecture 14: Application Programming Interface, Xml, String Literal

15 views4 pages

Document Summary

A variable holds either a primitive value or an object. int total = 100; primitive value double cost = 20. 45; primitive value. A class name can be used as a type to declare an object variable. No object is created w/ this declaration: q: what is a string object, a: co(cid:374)(cid:272)rete e(cid:454)a(cid:373)ple, (cid:862)this is a stri(cid:374)g. (cid:863) The object itself must be created separately. Generally, we use the new operator to create an object. Once an object has been created, we can use the dot operator to invoke its methods. A method may return a value, which can be used in an assignment or expression. A method invocation can be thought of as asking an object to perform a service. Because strings are so common, we don"t have to use the new operator to create a string object. This is special syntax that works only for strings. Each string literal (enclosed in double quotes) represents a string object.

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
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions