Comp3111_Lab2_Briefing_F2024
Comp3111_Lab2_Briefing_F2024
Basics
Bowen Zhang, [email protected]
Learning Outcomes
1) Be able to write a Java program and compile it with Gradle
Everything in Java is associated with classes and objects, along with its
attributes and methods.
Attribute: An attribute is a variable within a class that describes the characteristics or state of an object. Attributes
store data related to an object and can be accessed and modified using accessor (getter) and mutator (setter) methods.
Constructor: A constructor is a special type of method used to create and initialize objects of a class. When a new
instance of a class is created, the constructor is automatically called. Its main purpose is to allocate memory for the object
and set initial values.
Method: A method is a function within a class that defines the behavior or functionality of the class. Methods
encapsulate a series of operations and can accept parameters and return values. They define the actions that a class
can perform
Now you need to think about if we create another package like [Lab2b] under
[src.main.java], can we have another [mainApp2b] that can call the [Score] class
under [Lab2a]?
Yes, for sure we can work with cross package classes within a project.
But, how?
everywhere