Last active
August 31, 2021 12:10
-
-
Save minte9/aa63622dfe24968e5367f8db978ebebd to your computer and use it in GitHub Desktop.
Java / Basics / Object - https://www.minte9.com/java/basics-objects-1176
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create a new Dog instance ... | |
* Make the dog size = 10 | |
*/ | |
class App { | |
public static void main(String[] args) { | |
/** | |
* SOLUTION | |
*/ | |
Dog d = new Dog(); | |
d.size = 10; | |
System.out.println(d.size); // 10 | |
} | |
} | |
class Dog { | |
public int size; | |
public String name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment