Skip to content

Instantly share code, notes, and snippets.

@Alkimisti
Created March 1, 2021 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Alkimisti/7ce1493eab506bdfb1f25400cdd3c1aa to your computer and use it in GitHub Desktop.
Save Alkimisti/7ce1493eab506bdfb1f25400cdd3c1aa to your computer and use it in GitHub Desktop.
public class StringToBoolean {
public static void main(String[] args) {
String s1 = "true";
boolean b1 = Boolean.parseBoolean(s1);
System.out.println(b1);
String s2 = "TRUE";
boolean b2 = Boolean.parseBoolean(s2);
System.out.println(b2);
String s3 = "yes";
boolean b3 = Boolean.parseBoolean(s3);
System.out.println(b3);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment