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 Reception { | |
| static void greet() { | |
| //sout + Tab | |
| System.out.println("Hello from greet"); | |
| manage(); | |
| } | |
| static void manage() { | |
| System.out.println("Manager smth"); |
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 TernExample { | |
| public static void main(String[] args) { | |
| //Pre increment vs Post increment | |
| int x; | |
| int a; | |
| a = 0; | |
| x = 0; | |
| a = x++; | |
| System.out.println(a + " " + x); // a == 0, x == 1 | |
| a = 0; |
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 TestLineMethodMultT { | |
| public static void main(String[] args) { | |
| testLine(2, 6); | |
| testLine(6, 10); | |
| } | |
| private static void testLine(int a, int b) { | |
| for (int i = 2; i < 10; i++) { | |
| for (int j = a; j < b; j++) { | |
| System.out.printf("%d * %d = %2d\t", j, i, i * j); |
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 Test3MultTable { | |
| public static void main(String[] args) { | |
| //testLine(2, 6); | |
| //testLine(6, 10); | |
| //static void testLine ( int a, int b){ | |
| //исходя из его отработок рассчитать пары a и b | |
| for (int a = 2; a <= 6; a += 4) { | |
| for (int i = 2; i < 10; i++) { | |
| for (int j = a; j < (a + 4); j++) { |
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 Test2MultTable { | |
| public static void main(String[] args) { | |
| // long n = 461012; | |
| // System.out.format("%d%n", n); // --> "461012" | |
| // System.out.format("%08d%n", n); // --> "00461012" | |
| // System.out.format("%+8d%n", n); // --> " +461012" | |
| // System.out.format("%,8d%n", n); // --> " 461,012" | |
| // System.out.format("%+,8d%n%n", n); // --> "+461,012" | |
| // | |
| // double pi = Math.PI; |
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 Test3RPGGame1 { | |
| public static void main(String[] args) { | |
| int hp = testRandom(50, 120); | |
| int damage = testRandom(20, 150); | |
| int shield = testRandom(0, 80); | |
| System.out.printf("hp: %d, damage: %d, shield: %d%n", hp, damage, shield); | |
| int resultDamage = damage - shield; | |
| if (resultDamage > 0){ |
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 Test4Receipt { | |
| public static void main(String[] args) { | |
| String plate; | |
| plate = "листья салата, "; | |
| plate = plate + "соль, "; | |
| plate += "лимон, "; | |
| plate += "черный перец, "; | |
| plate = plate + blender("помидорки"); |
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
| import java.util.Scanner; | |
| public class BMIIndex { | |
| public static void main(String[] args) { | |
| //double height; | |
| //height = 166; | |
| //double weight; | |
| //weight = 60; | |
| Scanner scanner = new Scanner(System.in); |
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
| import java.util.ArrayList; | |
| public class TestArrayListExample1 { | |
| public static void main(String[] args) { | |
| newMenu(); | |
| System.out.println(newMenu()); | |
| } | |
| public static ArrayList newMenu() { | |
| ArrayList menu = new ArrayList(); |
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
| import java.util.Arrays; | |
| import java.util.Scanner; | |
| public class TwoArraysThreeNum { | |
| public static void main(String[] args) { | |
| Scanner sc = new Scanner(System.in); | |
| System.out.print("Enter first integer: "); | |
| int k = sc.nextInt(); | |
| sc.nextLine(); | |
| System.out.print("Enter second integer: "); |
OlderNewer