Last active
August 31, 2021 12:10
-
-
Save minte9/1b99ec19b56200f62284f8d69ac0582e to your computer and use it in GitHub Desktop.
Java / Basics / Variables - https://www.minte9.com/java/basics-variables-1178
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
/** | |
* Declare showInfo() method ... | |
* The method should display "Cooper is 3 age old" ... | |
* The method must have no return type | |
*/ | |
class App { | |
public static void main(String[] args) { | |
Dog d = new Dog(); | |
int age = 3; | |
String name = "Cooper"; | |
d.showInfo(age, name); // Cooper is 3 age old | |
} | |
} | |
class Dog { | |
/** | |
* SOLUTION | |
*/ | |
public static void showInfo(int age, String name) { | |
System.out.println(name + " is " + age + " old"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment