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
package SolarSystem; | |
public class Continent { | |
private String name; | |
public Continent(String name) { | |
this.name = name; | |
} |
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
package FileSystem; | |
public abstract class AbstractFSEntity implements FSEntity{ | |
public String name; | |
public AbstractFSEntity(String name) { | |
this.name = name; | |
} |
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
package EnumFilm; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class Film { | |
private String name; | |
private int year; |
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
package GenericSample; | |
public final class Pair<L,R> { | |
public Pair(L left, R right) { | |
this.left = left; | |
this.right = right; | |
} | |
@Override |
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
class Animals { | |
private String name; | |
private int age; | |
private String color; | |
public int getAge() { | |
return age; | |
} | |
public void setAge(int age) { |
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
public class Book { | |
private int id; | |
private String name; | |
private String author; | |
private int year; | |
private int pages; | |
private int price; | |
private String publishing; | |
private String bindingType; |
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
public class PalindromSample { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
int[] myArray = new int[10]; | |
arrayFiller(in, myArray); | |
getPalindromNumber(myArray); | |
} | |
private static boolean isPalindromNumber(int number) { |
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
public class MonthSample { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
int month = getScan(in); | |
checkMonth(month); | |
getMonth(month); | |
in.close(); |
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
class Rectangle { | |
private int height; | |
private int weight; | |
Rectangle(int height, int weight) { | |
checkParameters(height, weight); | |
this.height = height; | |
this.weight = weight; | |
} |
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
public class FactorialCalculator { | |
public static void main(String[] args) { | |
factorial(15); | |
} | |
public static long factorial(long n) { | |
if (n < 1 || n > 20) { | |
throw new IllegalArgumentException("Sorry"); | |
} else { | |
long factorial = 1; | |
for (int i = 1; i <= n; i++) { |
NewerOlder