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
========================================================== | |
SIMPLE VERSION OF CAT CLASS: | |
========================================================== | |
package com.alex.oop; | |
class Cat { // do not change class name! | |
// поля: | |
String name; // кличка кота |
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
package com.alex.constructors; | |
class Person { | |
String name; | |
String surname; | |
int age; | |
Person(String n, String s, int a) { | |
name = n; |
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
package com.alex.constructors; | |
class Person { | |
String name; | |
String surname; | |
int age; | |
Person() { // конструктор без параметров | |
name = "Иван"; |
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
package com.alex.destructor; | |
class Person { | |
String name; | |
String surname; | |
int age; | |
Person() { // конструктор без параметрів | |
name = "Олександр"; |
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
package com.alex.constructors; | |
class Person { | |
String name; | |
String surname; | |
int age; | |
Person() { // конструктор без параметров | |
name = "Иван"; |
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
package com.alex.constructors; | |
class Person { | |
String name = "Иван"; | |
String surname = "Иванов"; | |
int age = 25; | |
Person() { // конструктор без параметров |
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
package com.alex.constructors; | |
// клас, що представляє людину з ім'ям, прізвищем та віком | |
class Person { | |
private String name; | |
private String surname; | |
private int age; | |
// конструктор без параметрів | |
Person() { |
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
package com.alex.constructors; | |
import java.util.Arrays; | |
class Person { | |
String name; | |
String surname; | |
int age; |
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
package com.alex.encapsulation; | |
class Person { | |
Person ref = this; | |
String name; | |
String surname; | |
int age; |
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
package com.alex.encapsulation; | |
import java.util.Date; | |
class Person { | |
private String name; | |
private Date birthday; | |
private boolean knowJava; |