COMP SCI 200 Lecture Notes - Lecture 35: Code Smell, Indecent Exposure

67 views5 pages

Document Summary

Comp sci 200- lecture 35- classes pt 1 (first part of class was dedicated to reviewing the midterm) Classes provide a way of defining new types. Public members are accessible outside the class. Private members are only accessible inside the class. Creating instances of your own classes work just as the predefined. What is the output when executed? public class myclass { public int a; public myclass() { a = 5; public static void main() { What is the output? public class myclassbis { private int a; public myclassbis() { a = 5; public static void main(string[] args) { What is the output when usemyclass is run? public class usemyclass { public static void main(string[] args) { System. out. print(b. a); public class myclass { public int a; public myclass() { a = 5; public static void main(string[] args) { Myclass b = new myclass(); b. a = 10;

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