Created
December 4, 2021 13:26
-
-
Save satob/9a2e9b325b26ca5bef328e9920c73bfb to your computer and use it in GitHub Desktop.
Main.java
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 org.example; | |
public class Main { | |
public static void main(String[] args) { | |
String hoge = getHoge(); | |
String fuga = getFuga(10); | |
String piyo; | |
piyo = getPiyo(9,9); | |
piyo = getPiyo(11,9); | |
piyo = getPiyo(9,11); | |
piyo = getPiyo(11,11); | |
System.out.println("Hello World!:" + hoge + ":" + fuga + ":" + piyo); | |
} | |
public static String getHoge() { | |
return "HogeHoge"; | |
} | |
public static String getFuga(int y) { | |
int x = 13; | |
String fuga = "Fuga"; | |
if (x > 10) { | |
fuga = "Fuga x > 10"; | |
} | |
if (x < 10) { | |
fuga = "x < 10"; | |
} | |
if (x > 10 && y > 20) { | |
fuga = "Fuga x > 10 And y > 20"; | |
} | |
if (x > 10 || y > 20) { | |
fuga = "Fuga x > 10 Or y > 20"; | |
} | |
return fuga; | |
} | |
public static String getPiyo(int x, int y) { | |
String piyo = "Piyo"; | |
if (x < 10 && y < 10) { | |
piyo = "Piyo x > 10 And y > 10"; | |
} else if (x > 10 && y < 10) { | |
piyo = "Piyo x > 10 And y < 10"; | |
} else if (x < 10 && y > 10) { | |
piyo = "Piyo x < 10 And y > 10"; | |
} else if (x >= 10 && y >= 10) { | |
piyo = "Piyo x > 10 And y > 10"; | |
} | |
return piyo; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment