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 Perecroika { | |
public static void main(String[] args) { | |
// use knowledge 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"; | |
System.out.println(s.substring(52, 56) + (t.substring(17, 27)) + s.substring(56, 75)); | |
} |
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 VozvratDouble { | |
public static void main(String[] args) { | |
double value = 25.6; | |
int celoe = (int) value / 1; | |
double ostatok = value % 1; | |
System.out.println(celoe); | |
System.out.println(ostatok); | |
} |
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 VivodVremeni { | |
public static void main(String[] args) { | |
long sec = System.currentTimeMillis() / 1000; | |
int min = (int) sec / 60; | |
int chas = (int) min / 60; | |
int den = (int) chas / 24; | |
System.out.println(den + ":" + chas + ":" + min + ":" + sec); | |
} |
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 PoleBoy { | |
public static void main(String[] args) { | |
System.out.println("B B B B B B B B B"); | |
System.out.println("B C B"); | |
System.out.println("B W C B"); | |
System.out.println("B R B"); | |
System.out.println("B B B B B B"); | |
System.out.println("B R B"); | |
System.out.println("B T W 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 ZamenaPodstroki { | |
public static void main(String[] args) { | |
String mjQuote = "Let us always meet each other with smile, for the smile is the beginning of love."; | |
String zamena = mjQuote.replace("smile", ":)"); | |
System.out.println(zamena); | |
} | |
} |
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 Podstroka_1 { | |
public static void main(String[] args) { | |
String mjQuote = "I'm failed over and over again in my life and that is why I succeed!"; | |
System.out.println(mjQuote.substring(mjQuote.length() - "again in my life and that is why I succeed!".length(), | |
mjQuote.length() - "in my life and that is why I succeed!".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 Podstroka { | |
public static void main(String[] args) { | |
System.out.println("I'm failed over and over again in my life and that is why I succeed!".substring(59, 67)); | |
/*Требование первого ограничения пока не дошло*/ | |
} | |
} |
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 PoslednySymvol { | |
public static void main(String[] args) { | |
String mjQuote = "I'm failed over and over again in my life and that is why I succeed!"; | |
System.out.println(mjQuote.length()); | |
System.out.println(mjQuote.charAt(67)); | |
} | |
} |
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 MetodRazmer { | |
public static void main(String[] args) { | |
String name = "Bogdan"; | |
System.out.println(name.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 Stroki { | |
public static void main(String[] args) { | |
System.out.println("Привет ДЖАВА"); // напечатайте любую строку | |
System.out.println("Привет " + "ДЖАВА"); // напечатайте любую строку c конкатенацией | |
System.out.println("Привет ДЖАВА " + 25 + " раз"); // сложите строку c числом | |
System.out.print("Привет ДЖАВА " + 25 + " раз"); // используйте System.out.print | |
System.out.print(" "); // возможно ли вывести на экран пустую строку? | |
} |
NewerOlder