Professional Documents
Culture Documents
Class constructors
Subject: Android fundamentals for Smart Home
Mgtr. José Alcides RumipambaLópez
Constructors types
1.9. Encapsulation and
visibility
Subject: Android fundamentals for Smart Home
Mgtr. José Alcides RumipambaLópez
Encapsulation
▪ These are used for consult and modify the private attributes of a
class.
Getter and setter methods
Private attributes:
Using getter and setter methods
Result:
Using getter and setter methods
Classwork # 4:
Develop the necessary code in the main class of “Mathematics V1” to
obtain the prime, pair and odd number and modify these using
keyboard.
Result:
Inheritance example
Classwork # 5:
Create a new class into “Mathematics_V1” named “NegativeNumber”
that inherits from “DecimalNumber” and add a new attribute designate
“NegativeNumber” .
Classwork # 6:
Program the respective code for
show the system that shows the
figure.
Student
- Name: String
- Address: String
- Picture: String
- Age: Integer
- Phone: Integer
- Commentary: String
Example:
<Parent class> OBJECT = new <Child class>(settings)
Interface
▪ The interface is an abstract class that contain methods but these not
implemented. It can also contain attributes but static and final type.
Example:
List
Example:
List example
List example
Example:
List example
Classwork # 7:
▪ Build a system that
show the figure: