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 BATTLEFRONT { | |
| public static void main(String[] args) { | |
| sum(8,5); | |
| } | |
| static void sum(int num1,int num2) { |
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 BATTLEFRONT { | |
| public static void main(String[] args) { | |
| hello("lesson 2 "); | |
| hello("Oleg"); | |
| } | |
| static void hello(String name) { | |
| System.out.println("hello" + " " + 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
| public class Documents { | |
| public static void main(String[] args) { | |
| String a1 = "use "; | |
| String b2 = "knowledge "; | |
| String c3 = "to change the world "; | |
| String s = "Education is the most powerful weapon which you can use to change the world "; | |
| String t = "An investment in knowledge pays the best interest"; | |
| String st = s + t; |
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 Documents { | |
| public static void main(String[] args) { | |
| double value = 25.6; | |
| String str = String.valueOf(value); | |
| int p= str.indexOf('.'); | |
| System.out.println(str.substring(0,p)); | |
| System.out.println(str.substring(p+1)); |
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 Documents { | |
| public static void main(String[] args) { | |
| // we must calculate how many D:H:M:S from 1 January 1970 to today | |
| long time = System.currentTimeMillis()/1000; | |
| int day = (int) time / (60 * 60 * 24); |
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 Documents { | |
| public static void main(String[] args) { | |
| System.out.println("B B B B B B B B B"); | |
| System.out.println("B C T C B"); | |
| System.out.println("BRRR RR RR R RB"); | |
| System.out.println("BWW R B"); | |
| System.out.println("B WW WW B"); | |
| System.out.println("B E B"); | |
| System.out.println("B WW WW B"); |
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 Documents { | |
| public static void main(String[] args) { | |
| String mtQuote = "lets us always meet each other with smile,for the smile isthe beginning of love"; | |
| System.out.println(mtQuote.replace("smile",":)")); | |
| } | |
| } |
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 Documents { | |
| public static void main(String[] args) { | |
| String mjQuote = "I've failed over and over and over again in my life and that is why I succed! "; | |
| System.out.println(mjQuote.substring(mjQuote.indexOf("again"), mjQuote.indexOf("again") + "again".length())); | |
| } | |
| } |
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 Documents { | |
| public static void main(String[] args) { | |
| String mjQuote = "I've failed over and over and over again in my life and that is why I succed! "; | |
| System.out.println(mjQuote.substring(70, 76)); | |
| } | |
| } |
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 Documents { | |
| public static void main(String[] args) { | |
| String drQuote = "my name ilya. im live in kiev. im like computer"; | |
| int length = drQuote.length(); | |
| char ch = drQuote.charAt(length - 1); | |
| System.out.println(ch); |