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
System.out.println("1------------------------------------------------------"); | |
// 3 weeks == (7 * 3 = 21 days in 3 weeks) == (24 days = 24 * 24 hours = 576 hours in 24 days) == | |
// == (576 hours = 576 hours * 60 min = 34560 minutes in 576 hours) == (34560 min = 34560 * 60 sec = 2073600 seconds in 3 weeks) | |
System.out.println(3 * 7 * 24 * 60 * 60 ); | |
} |
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 Lesson1_HomeWork { | |
public static void main(String[] args) { | |
String greeting = "Hello from Java"; | |
String str; | |
System.out.print("Some string"); | |
System.out.print("Hello "+"concatination!" ); | |
str = "155"+45; | |
System.out.print(str); | |
System.out.print(""); |
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 Lesson1_HomeWork { | |
public static void main(String[] args) { | |
String name = "Egor"; | |
System.out.println(name.length()); | |
} | |
} |
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 Lesson1_HomeWork { | |
public static void main(String[] args) { | |
String mjQuote = "I'm falied over and oevr and over again in my life and thats is why I succeed!"; | |
System.out.println(mjQuote.charAt(mjQuote.length() - 1)); | |
} | |
} |
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 Lesson1_HomeWork { | |
public static void main(String[] args) { | |
String mjQuote = "I've falied over and oevr and over again in my life and thats is why I succeed!"; | |
System.out.println(mjQuote.substring(mjQuote.length()-1-7, mjQuote.length()-1)); | |
} | |
} |
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 main { | |
public static void main(String[] args) { | |
String str1 = "I've falied over and over and over again in my life and that is why I succeed"; | |
System.out.println(str1.substring(str1.indexOf("again"), str1.indexOf("again") + "again".length())); | |
} | |
} |
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 main { | |
public static void main(String[] args) { | |
String str1 = "Let us always meet each other with smile, for the smile is the beginning of love "; | |
System.out.println(str1.replaceAll("smile", ":)")); | |
} | |
} |
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 main { | |
public static void main(String[] args) { | |
System.out.println("WW C WW"); | |
System.out.println("RRR RRRR"); | |
System.out.println("WW WW"); | |
System.out.println("WE W WRRR"); | |
System.out.println("RWWR RWWR"); | |
System.out.println("BB BB"); | |
System.out.println(" BBRBB "); | |
System.out.println(" BBB "); |
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 main { | |
public static void main(String[] args) { | |
long millis = System.currentTimeMillis(); | |
System.out.println(millis/(24*60*60*1000L) + | |
": " + millis/(60*60*1000L) + | |
": " + millis/(60*1000L) + | |
": " + millis/(1000L)); | |
} | |
} |
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 main { | |
public static void main(String[] args) { | |
double value = 25.6; | |
System.out.println((String.valueOf(value).substring(0, String.valueOf(value).indexOf("."))) +'\n' + | |
(String.valueOf(value).substring(String.valueOf(value).indexOf(".") + 1, String.valueOf(value).length()))); | |
} | |
} |
OlderNewer