Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Vowels

  1. #1
    Junior Member
    Join Date
    Jan 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Vowels

    this is my code and the str thingy cannot find could anyone help me thank you! and this the error

    import java.util.Scanner;
    public class Upper 
    {
    public static void main(String[] args) 
    {
    java.util.Scanner scn= new java.util.Scanner(System.in);
    System.out.print("Enter Words: ");
               String s1=scn.next();
               System.out.println("original string = " + str);
               System.out.println("After replacing all vowels into capital case = " +
                                          str.replaceAll("a", "A").replaceAll("e", "E")
                                          .replaceAll("i", "I").replaceAll("o", "O")
                                          .replaceAll("u", "U"));
        }
    Capture.JPG
    Last edited by hellshitt; January 3rd, 2019 at 08:42 PM. Reason: wrong

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,327
    Thanks
    53
    Thanked 2,393 Times in 2,347 Posts

    Default Re: Vowels

    Please copy the full text of any error messages and paste it here.

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Jan 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Vowels

    Capture.JPG
    this is the error

  4. #4
    Junior Member
    Join Date
    Jan 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Vowels

    import java.util.Scanner;
    public class Upper 
    {
    public static void main(String[] args) 
    {
    java.util.Scanner scn= new java.util.Scanner(System.in);
    System.out.print("Enter Words: ");
    String s1=scn.next();
    System.out.println("original string = " + str);
    System.out.println("After replacing all vowels into capital case = " +
    str.replaceAll("a", "A").replaceAll("e", "E")
    .replaceAll("i", "I").replaceAll("o", "O")
    .replaceAll("u", "U"));
    }

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,327
    Thanks
    53
    Thanked 2,393 Times in 2,347 Posts

    Default Re: Vowels

    Please do not post images. It is impossible to copy text from an image to include in a response.

    The compiler can not find the definition for the variable: str. Make sure the code defines str before using it.
    The String variable s1 is defined but not used.
    Perhaps one of those should be changed to the other.
    If you don't understand my answer, don't ignore it, ask a question.

  6. #6
    Junior Member
    Join Date
    Jan 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Vowels

    Thank you

Similar Threads

  1. [SOLVED] Vowels
    By Java girl in forum What's Wrong With My Code?
    Replies: 8
    Last Post: April 14th, 2014, 09:27 PM
  2. How to replace the vowels with a user input Character
    By gdoggson in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 4th, 2013, 04:53 AM
  3. Counting Vowels and Consonants in a String.
    By Andyandhisboard in forum What's Wrong With My Code?
    Replies: 14
    Last Post: January 8th, 2013, 08:59 PM
  4. [SOLVED] Program to find how many letters start with vowels
    By Lokesh in forum What's Wrong With My Code?
    Replies: 4
    Last Post: February 14th, 2011, 04:58 AM
  5. Counting Vowels and Prepositions in a text file
    By maybach230 in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: April 27th, 2010, 07:36 PM