Hugging Face
Models
Datasets
Spaces
Community
Docs
Enterprise
Pricing
Log In
Sign Up
Spaces:
KaiquanMah
/
TurkuBasicOOPinJava
like
0
Running
App
Files
Files
Community
main
TurkuBasicOOPinJava
/
Week 6: Methods of OO Programming
Ctrl+K
Ctrl+K
1 contributor
History:
26 commits
KaiquanMah
Create 16. The Last Piece, Part 3: The Game Board
6bd73f4
verified
5 days ago
01A. Static members [= CLASS MEMBER, not object member]
Safe
5.13 kB
public static dtype method1(param1) {...}
6 days ago
01B. Class StringHelper
Safe
2.15 kB
public static int method1(dtype param1)
6 days ago
02. Class SecretAgent
Safe
4.39 kB
if (staticMethod2(param1)) {...}
6 days ago
03A. Class variables = STATIC VARIABLES
Safe
2.21 kB
public static dtype STATICVARIABLEINCAPS = <value>;
6 days ago
03B. Nordic countries as class variables
Safe
728 Bytes
public static String FINLAND = "FI";
6 days ago
04. Fish within permitted limits
Safe
2.41 kB
this.attribute1 >= Class2.PUBLICSTATICATTRIBUTE2
6 days ago
05A. Interfaces+++
Safe
4.87 kB
interface INTERFACE1 {dtype method1();}
6 days ago
05B. Write an interface class Calculator
Safe
1.31 kB
void add(int number); double getResult();
6 days ago
06. The Calculator implements an interface
Safe
3.6 kB
@Override public void add(int number) {this.result += number;}
6 days ago
07A. Interface 'Comparable' [compareTo method]+++
Safe
4.99 kB
int/double, str (alphabetical)
5 days ago
07B. Determine the Longest Route
Safe
3.47 kB
@Override public int compareTo(Route other)
5 days ago
08. Comparable Point
Safe
3.21 kB
condition compares using double, then return int
5 days ago
09 Polymorphism+++
Safe
7.31 kB
reusable method for SUPERCLASS n SUBCLASSES, ArrayList, SUPERCLASS METHOD
5 days ago
09B. Oldest Fairy Tale Character
Safe
4.36 kB
Create 09B. Oldest Fairy Tale Character
5 days ago
10A. Interface Class as Variable Type+++
Safe
2.46 kB
public static Priced mostExpensive(ArrayList<Priced> list) {...}
5 days ago
10B. How Many Can Fit in a Container?
Safe
3.46 kB
public static int howManyFit(Container largeContainer, Container smallContainer) {...}
5 days ago
11A. TYPE Conversions OR CASTING+++
Safe
2.01 kB
int approximation = (int) height;
5 days ago
11B. Calculate the Total Load of Trucks
Safe
2.49 kB
SubClass1 subClassVar1 = (SubClass1) superClassVar1;
5 days ago
12A. Dynamic Binding+++
Safe
6.07 kB
FIND LATEST IMPLEMENTED METHOD vs instanceof vs getClass [OBJECT TYPE]
5 days ago
12B. Count the Wizards [instanceof]
Safe
5.65 kB
if (obj1 instanceof Class1) { countClass1++; }
5 days ago
13. People on Ships
Safe
4.04 kB
people += ((PassengerShip) ship).getPassengers();
5 days ago
14A. Modifier 'final'+++
Safe
4.29 kB
final LocalVariable/ClassAttribute/MethodParam/Method/Class
5 days ago
14B. The Last Piece, Part 1: The Color Class
Safe
1.52 kB
public static final int VARIABLE = 2;
5 days ago
15. The Last Piece, Part 2: The GamePiece Class
Safe
1.41 kB
final class Class1 {...}
5 days ago
16. The Last Piece, Part 3: The Game Board
Safe
9.82 kB
Create 16. The Last Piece, Part 3: The Game Board
5 days ago