COMP 1405 Lecture Notes - Object File, Type Class

33 views8 pages

Document Summary

//declares string names firstname1 = hank; lastname1 = urchif; firstname2 = holly; lastname2 = day; firstname3 = bobby; lastname3 = socks; //set string values public static void main (string args[]) { //the following program shows the usage of string data type class ch2_0string3 { //class object required for the ch2_1person and ch2_1person2 program class ch2_1personobject { //declares 2 string names in the object file. //other data types such as int, char and boolean etc can also be used here. //the following program demonstrates the usage of class objects class ch2_1person { public static void main (string args[]) { //declares an object name aperson = new ch2_1personobject(); //creates a new ch2_1personobject aperson. firstname = hank; aperson. lastname = urchif; //sets values to the firstname and lastname string in the. //ch2_1personobject class means an component (such as variable, function etc) with an class. //outputs the same result as the previous program aperson. firstname = max; aperson. lastname = power;

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