Vajad kellegagi rääkida?
Küsi julgelt abi LasteAbi
Logi sisse
Sulge

"equalsignorecase" - 2 õppematerjali

PPK outdated
24
doc

PPK(outdated)

String s = "string"; String s1 = ""; String s2 = ""; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) != ' ') { s1 += s.charAt(i);}} System.out.println(s1); for (int i = s1.length() - 1; i >= 0; i--) { s2 += s1.charAt(i);} System.out.println(s2); if (s1.equalsIgnoreCase(s2)) { System.out.println("Palindrome"); } else { System.out.println("Fail"); }}} 6. If a letter is in the given string, put it into brackets. Tere e -> T(e)r(e) List list = new ArrayList(); String t= “ ”; char e = 'e'; for (int i = 0; i < t.length(); i++) { if (t.charAt(i) == e) {

Informaatika → Java programmeerimine
35 allalaadimist
Objektorienteeritud programmeerimise loengutekst
40
odt

Objektorienteeritud programmeerimise loengutekst

Sõneliteraal char[] tähed = {'a','b','c'}; char[] tähed2 = {'a','b','c'}; String sõne1 = new String(tähed); String sõne2 = new String(tähed2); String sõne3 = "abc"; String sõne4 = "abc"; false System.out.println(sõne1 == sõne2); false System.out.println(sõne1 == sõne3); True System.out.println(sõne3 API == compareTo, equals, equalsIgnoreCase, indexOf, length, replace, võrdlus meetodid ­ charAt, sõne4); toLowerCase, toUppercase, toString Meetod, mis tuvastab palindroomi static boolean onPalindroom(String s) { int algusest = 0; //esimene märk int lõpust = s.length() - 1; //viimane märk while (algusest < lõpust) { if (s.charAt(algusest) != s.charAt(lõpust)){ return false; // ei ole palindroom } algusest++; lõpust--; }

Informaatika → Programmeerimine
84 allalaadimist


Sellel veebilehel kasutatakse küpsiseid. Kasutamist jätkates nõustute küpsiste ja veebilehe üldtingimustega Nõustun