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 class and output "Hello Java!" | |
* Java code always starts in the main() method | |
*/ | |
class MyClass { | |
/** | |
* SOLUTION | |
*/ | |
public static void main(String args) { |
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 |
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 an array nums of integers ... | |
* The array must have the length = 3 ... | |
* First element nums[0] should display 100 | |
*/ | |
class App { | |
public static void main(String[] args) { | |
/** |
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) { | |
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
/** | |
* Make a for-each loop and ... | |
* Output all names | |
*/ | |
class LearningApp { | |
public static void main(String[] args) { | |
String[] names = {"John", "Marry", "Ana"}; |
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 Number no as float 22.23 ... | |
* Use object's shortValue() method and ... | |
* Display no as 22 | |
*/ | |
class App { | |
public static void main(String[] args) { | |
/** |
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
/** | |
* Define a string s1 = "1" | |
* Define a number n1 = 2 | |
* Display the sum of s1 + n1 = 3 | |
* (convert the string to number) | |
*/ | |
class App { | |
public static void main(String[] args) { | |
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
<?php | |
/** | |
* Define $output on multiple $lines | |
* Use Herodoc syntax. | |
* | |
* output = | |
* She said "This is John's test" | |
* on multiple rows | |
*/ |
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
<?php | |
/** | |
* Compose $m octal value using myFunc() recursively | |
* Use reminder and quontient values | |
* | |
* 97 (decimal) = 141 (octal) | |
* 97 % 8 => reminder 1 | |
* 12 % 8 => reminder 4 | |
* 1 % 8 => reminder 1 |
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
<?php | |
/** | |
* Define getMaxValue() method | |
* Use static syntax | |
*/ | |
class MyClass { | |
const MAX_VALUE = 100; |
OlderNewer