(Updated July 14, 2024) String name; int len; name = “Bill”; len = name.length(); System.out.println(name.charAt(0)); System.out.println(name.charAt(1)); System.out.println(name.charAt(2)); System.out.println(name.charAt(3)); System.out.println(“The length of the string is ” + len); String name; int len; name = “Bill”; len = name.length(); System.out.println(name.charAt(0)); System.out.println(name.charAt(1)); System.out.println(name.charAt(2)); System.out.println(name.charAt(3)); System.out.println(“The length of the string is ” + len); String name; int len; name … Read More “Comparative Languages” »
Category: Code
To get you started on Project 6, here is the basic code to read the checkme.txt file. It reads words, converts to upper case, and strips extraneous punctuation. import java.io.FileNotFoundException; import java.io.FileReader; import java.util.Scanner; public class Main { public static String removeNonLetDig(String s) { int b = 0, e = s.length()-1; // Trim from the … Read More “Project 6 Hashing Stuff” »
Consider what things would be like without the wrapper classes. How could we classify chars? For instance, alphabetic, numeric, alphanumeric. Or how could you convert between case? CharEx.java public class CharEx { public static void main(String[] args) { char c; c = ‘a’; System.out.println(c); if ( c >= ‘0’ && c = ‘A’ && c … Read More “What if we didn’t have Character?” »