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

  • SEARCH
  • Home
  • 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 9150507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:37:13+00:00 2026-06-17T11:37:13+00:00

I am interested in a very simple string verification problem to see if the

  • 0

I am interested in a very simple string verification problem to see if the starting character in a string starts with an upper case letter and then have the console to display true or false. From my understanding you wouldn’t have to invoke something like System.console().printf(“true”, s) in order to make this happen. I could swear I’ve seen similar elementary implementations achieved using the following sample code:

public class Verify {
    public static boolean checkStartChar(String s) {
        if (s.startsWith("[A-Z]")) {
            return true;
        } else {
            return false;
        }
    }

    public static void main(String[] args) {
        String str = "abCD";
        checkStartChar(str);
    }
}

but when I run this, nothing displays. If I make a slight modification by adding in conditional printouts before returning T/F, e.g.

public class Verify2 {
    public static boolean checkStartChar(String s) {
        if (s.startsWith("[A-Z]")) {
            System.out.println("yep");
            return true;
        }
        else {
            System.out.println("nope");
            return false;
        }
    }

    public static void main(String[] args) {
        String str = "abCD";
        checkStartChar(str);
    }
}

the issue is somewhat resolved, as the console displays either “yep” or “nope”, yet unresolved because I just want the console to display true or false. That’s it. Advice?

  • 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-17T11:37:13+00:00Added an answer on June 17, 2026 at 11:37 am

    yet unresolved because I just want the console to display true or false

    Calling checkStartChar method will return value, that doesn’t mean it will print value to console. You need to code how you would like to handle return value. If you want to print return value, then you should do:

    System.out.println(checkStartChar(str));
    

    Will print what ever the return of checkStartChar method

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am very interested in postgesql because they have a uuid data type. I
I have very interested in using MongoDB it seems awesome. But I'm from a
I have a simple html input textbox in a very simple form. the information
I have a very simple set-up. Table Node has a nullable foreign key ObjectId.
I have been very interested as of late in interfaces and the ability to
I have a very simple JPA entity. It features some simple metadata fields, and
I am tryying to implement a very simple Spring MVC application however not interested
I am very interested in using CI phonegap and jquery to make mobile apps,
I am very interested in the Web Services Connector for Java Management Extensions (JMX)
I am very interested in mobile application development. But which language or framework is

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.