This file contains hidden or 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
| public class Main { | |
| public static void main(String[] args) { | |
| Person androidDeveloper = | |
| new PersonWithoutPhoneNumber("Kyriakos", "Georgiopoulos"); | |
| Person personWithPhoneNumber = | |
| new PersonWithPhoneNumber(androidDeveloper, "(123)-456-7890"); | |
| Person androidDeveloperWithChangedPhoneNumber = personWithPhoneNumber.anotherOnePersonWithNewPhoneNumber("(030)-311-5222"); |
This file contains hidden or 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
| class PrintDemo { | |
| public void printCount() { | |
| try { | |
| for (int i = 5; i > 0; i--) { | |
| System.out.println("Selected number is: " + i ); | |
| } | |
| } catch (Exception e) { | |
| System.out.println("Thread has been interrupted."); | |
| } | |
| } |