Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8612569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:39:43+00:00 2026-06-12T04:39:43+00:00

so i have to write a java code to : Input a name Format

  • 0

so i have to write a java code to :

  • Input a name
  • Format name in title case
  • Input second name
  • Format name in title case
  • Display them in alphabet order

i know that The Java Character class has the methods isLowerCase(), isUpperCase, toLowerCase() and toUpperCase(), which you can use in reviewing a string, character by character. If the first character is lowercase, convert it to uppercase, and for each succeeding character, if the character is uppercase, convert it to lowercase.

the question is how i check each letter ?
what kind of variables and strings should it be contained ?
can you please help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:39:44+00:00Added an answer on June 12, 2026 at 4:39 am

    You should use StringBuilder, whenver dealing with String manipulation.. This way, you end up creating lesser number of objects..

    StringBuilder s1 = new StringBuilder("rohit");
    StringBuilder s2 = new StringBuilder("jain");
    
    s1.replace(0, s1.length(), s1.toString().toLowerCase());
    s2.replace(0, s2.length(), s2.toString().toLowerCase());            
    
    s1.setCharAt(0, Character.toTitleCase(s1.charAt(0)));
    s2.setCharAt(0, Character.toTitleCase(s2.charAt(0)));
    
    if (s1.toString().compareTo(s2.toString()) >= 0) {
        System.out.println(s2 + " " + s1);
    
    } else {
        System.out.println(s1 + " " + s2);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem; I want to write a java code for sending an
Possible Duplicate: Java GUI repaint() problem? I write a Java code, but I have
I have a short question i have wrote this in java. Old code: class
I have wrote the code below which was taken from Java How to program
I have to write a Java program that tells what coins to give out
I have been asked to write a java program on linux platform. According to
I have to write an XML file using java.The contents should be written from
I have a situation where I have to write a client in Java against
How to write a java program which will tell me whether I have internet
I need to write a java JCE provider. I have been looking in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.