Remplacez les ?
par les bonnes réponses
Created
October 5, 2023 10:51
-
-
Save nherbaut/a00e413d8ae6563376065d3bc5906165 to your computer and use it in GitHub Desktop.
L2.3.4 Diverses fonctions de la classe String
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
true | |
true | |
true | |
true | |
true | |
true | |
true | |
true |
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 StringSubString{ | |
public static void main(String... args){ | |
String s = "sorbonnepantheonMIASHS"; | |
String resp1 = s.substring(8,16); | |
String myGuess1="pantheon"; // Réponse ici | |
int resp2 = s.length(); | |
int myGuess2 = ?;// Réponse ici | |
int resp3 = s.indexOf("bonne"); | |
int myGuess3 = ?;// Réponse ici | |
int resp4 = s.indexOf("n"); | |
int myGuess4 = ?;// Réponse ici | |
int resp5 = s.indexOf("CRI"); | |
int myGuess5 = ?;// Réponse ici | |
int resp6 = s.indexOf("n",7); | |
int myGuess6 = ?;// Réponse ici | |
boolean resp7 = s.startsWith("sorbonne"); | |
boolean myGuess7 = ?;// Réponse ici | |
boolean resp8 = s.endsWith("L1"); | |
boolean myGuess8 = ?;// Réponse ici | |
System.out.println(resp1.equals(myGuess1)); | |
System.out.println(resp2==myGuess2); | |
System.out.println(resp3==myGuess3); | |
System.out.println(resp4==myGuess4); | |
System.out.println(resp5==myGuess5); | |
System.out.println(resp6==myGuess6); | |
System.out.println(resp7==myGuess7); | |
System.out.println(resp8==myGuess8); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
execute me on https://java.miage.dev/?gistId=a00e413d8ae6563376065d3bc5906165