To Lecture Notes
IT 372 -- May 14, 2025
Review Questions
- Write an Android app that draws vertical lines in
a MyView object placed in a linear layout. Use radio buttons to specify the
color: red, blue, and white.
Answer: activity_main.xml
MainActivity.java
VertLine.java
MyView.java
- Write an Android app that displays a circle in
a MyView object placed in a linear layout. Use a seekbar to change the
radius of the circle from 30 to 200 pixels and back.
Answer: activity_main.xml
MainActivity.java
MyView.java
- In what ways is Kotlin similar to and different from Java?
Answer. Similarities:
-- Both run on the Java Virtual Machine (JVM).
-- Datatypes of variables are determined at compile time (statically typed).
-- Both are object oriented.
-- Both use // for comments and { } for block delimiters.
Differences:
--
Kotlin is more concise than Java.
-- Kotlin does not require semicolons at
the end of lines.
-- Kotlin constructors are implemented as parameters to the
class itself.
- After looking at the examples in the Introduction to Kotlin document,
implement the Magic8Ball Example using Kotlin for the Prediction and
MainActivity classes.
Look at these sections in the Introduction to Kotlin document.
- Constants
- Arrays
- Lists
- Classes