Results 1 to 4 of 4
  1. #1
    padutch2 is offline Member
    Join Date
    Nov 2007
    Location
    Hershey, PA
    Posts
    13
    Rep Power
    0

    Default What jdk do I download?

    I use Netbeans at school and just downloaded the most newest version of it but I need to download a jdk or something and i dont know which one to downoad.

  2. #2
    padutch2 is offline Member
    Join Date
    Nov 2007
    Location
    Hershey, PA
    Posts
    13
    Rep Power
    0

    Default

    Also I got to design this one program but im stuck, can anyone point me in the right direction?

    Design and implement an application that reads a string from the user, then determines and prints how many of each lowercase vowel (a,e,i,o,u) appear in the string. Have a seperate counter for each vowel. Also count and print the number of constants,spaces, and punctuation marks.

  3. #3
    staykovmarin is offline Senior Member
    Join Date
    Nov 2007
    Location
    Newport, WA
    Posts
    141
    Rep Power
    0

    Default

    If you want all the newest features, then you should definitely get jdk6. I use 5, because there is nothing in 6 that i need.

    You can use a Regex to do that:
    Java Code:
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    
    public class RegexFinder {
    	public static void main(String args[]) {
    		try {
    			new RegexFinder();
    		} catch (IOException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    	}
    
    	RegexFinder() throws IOException {
    		// this is the Regex pattern:
    		// any vowels: aeiou
    		// spaces: \\s
    		// punctioation : ?.,! (note: the ! must be escaped \\! because in Regex
    		// it means NOT. we are just looking for the ! char
    		Pattern pattern = Pattern.compile("[aeiou\\s?.,\\!]");
    		// edit: forgot that you needed it to read from command line
    		while (true) {
    			System.out.print("Enter the string to search: ");
    			BufferedReader in = new BufferedReader(new InputStreamReader(
    					System.in));
    			Matcher m = pattern.matcher(in.readLine());
    
    			// all the counter variables
    			int a = 0, e = 0, i = 0, o = 0, u = 0, space = 0, punks = 0;
    			while (m.find()) {
    				// this switch looks trough each character matched by the regex,
    				// and
    				// evaluates it
    				switch ((int) m.group().charAt(0)) {
    				case 'a':
    					a++;
    					break;
    				case 'e':
    					e++;
    					break;
    				case 'i':
    					i++;
    					break;
    				case 'o':
    					o++;
    					break;
    				case 'u':
    					u++;
    					break;
    				case ' ':
    					space++;
    					break;
    				default:
    					// if it is not any of the above, but still found by the
    					// regex,
    					// it must be a punctioation mark
    					punks++;
    				}
    			}
    
    		System.out.println("# of a=" + a + "\n# of e=" + e + "\n# of i=" + i
    				+ "\n# of o=" + o + "\n# of u=" + u + "\n# of spaces=" + space
    				+ "\n# of punctuation marks=" + punks);
    		}
    	}
    }
    Last edited by staykovmarin; 11-29-2007 at 01:33 AM.

  4. #4
    padutch2 is offline Member
    Join Date
    Nov 2007
    Location
    Hershey, PA
    Posts
    13
    Rep Power
    0

    Default

    oh ok i was thinking about useing cases but i forgot how they worked. thanks sir

Similar Threads

  1. Download JDK 1.5
    By Nick15 in forum New To Java
    Replies: 4
    Last Post: 01-01-2009, 03:10 AM
  2. file download
    By abhiN in forum New To Java
    Replies: 0
    Last Post: 02-08-2008, 09:10 AM
  3. how to download using java
    By leonard in forum Advanced Java
    Replies: 1
    Last Post: 08-06-2007, 05:36 PM
  4. Help with download java api
    By fernando in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 02:36 AM
  5. I could download JDK 1.5
    By Albert in forum New To Java
    Replies: 2
    Last Post: 07-13-2007, 03:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •