Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
CS 251
Lab Exercise #5
Due: In Lab, the week of February 28th, 2011.
Main topics: Public vs Private
Static (Class) vs non-static (Instance)
This week we will be experimenting with Java’s public, private, and static modifers. You are to
devise a class and a driver class that will allow you to ”try” to access every combination of public,
private, static, non-static variable and method, from both within the class and from a driver class
(client).
Getting Started To start this exercise, you should first change into your lab directory and create
a directory named 05.
Eclipse 1. Open Eclipse
2. Open a new java project named Lab05
¡your class¿.java 1. Write a class which has all of the neccesary components, but do not do not
”try” to access any of these components in any of the method body’s just yet.
2. One by one ”try” to access a component of your class (in each possible context, from
within your class), compile your class and note any errors reported.
¡your class¿Driver.java 1. Write a driver class which constructs a new object of your class, but
do not do not ”try” to access any class or instance components just yet.
2. One by one ”try” to access a component of your class (in each possible context, as a
client of your class), compile your driver class and note any errors reported.
Check off
Once you finish this lab, you should see your Lab TA to let them know you are finished with this
lab so that they can check you off.
1