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 7 of 7

Thread: strings

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default strings

    strings are immutable in java...so can we apply toupper nd tolower function directly in a string


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Strings

    Are you talking about the java SE String class? Look at the API doc for how to use the methods that you are asking about. If you have any questions about the doc, copy the text here and ask your questions about it.
    Last edited by Norm; September 21st, 2014 at 10:40 AM. Reason: Fix spelling
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Sep 2014
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question strings are immutable ...iam little confused

    import static java.lang.System.*;
    import java.util.Scanner;

    class StringTest3
    {
    public static void main(String args[])
    {
    String str = "Unisoft Technologies"; //immutable
    out.println(str);

    String temp;

    temp = str.replace("soft","hardware");
    out.println(temp);

    temp = str.toUpperCase();
    out.println(temp);

    temp = str.toLowerCase();
    out.println(temp);

    temp = str.concat(", Dehradun");
    out.println(temp);
    }
    }





    i want to know,if strings are immutable in java,so how i become able to change the given string into uppercase,lowercase,even iam able to concatenate it with other string

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: strings

    Threads merged.

    Please don't start multiple threads on the same topic.

    You should also know how to post your code using code or highlight tags as explained near the top of this topic. If you need help with that, PM me.

  5. #5
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    666
    Thanks
    0
    Thanked 121 Times in 105 Posts

    Default Re: strings

    Do you have a question?

  6. #6

    Default Re: strings

    Strings, which are widely used in Java programming, are a sequence of characters. In Java programming language, strings are treated as objects. The Java platform provides the String class to create and manipulate strings.

  7. #7
    Junior Member
    Join Date
    Sep 2017
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: strings

    I'm not quite sure I understand your question but to me it looks like you're asking if we can modify a String to its lowercase or uppercase variant in which case the answer is yes:

    	public class UpperAndLower {
     
    		public static void main(String[] args) {
    			String lower = "LowEr";
    			String upper = "uPPeR";
    			System.out.println(lower.toLowerCase() + " - " + upper.toUpperCase());
    		}
     
    	}

Similar Threads

  1. Sorting lowercase strings before uppercase strings
    By keepStriving in forum Java Theory & Questions
    Replies: 4
    Last Post: March 26th, 2014, 03:33 PM
  2. Strings
    By NewCoder in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 27th, 2014, 04:51 AM
  3. Strings
    By Leeds_Champion in forum Algorithms & Recursion
    Replies: 3
    Last Post: November 3rd, 2009, 10:09 PM
  4. Strings
    By BeSwift21 in forum Java Theory & Questions
    Replies: 1
    Last Post: October 13th, 2009, 07:02 PM
  5. Replies: 2
    Last Post: June 19th, 2008, 03:58 AM