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 878027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:42:20+00:00 2026-05-15T11:42:20+00:00

Ok, I’m working on a simple statement code and it works fine as long

  • 0

Ok, I’m working on a simple statement code and it works fine as long as the input matches, ie Upper Case. I found it to.UpperCase and it looks simple enough, but still no dice.
my code:

public static void main(String[] args) {
//public static char toUpperCase(char LG) // If I put this in, it gives me 'illegal start of expression'

char LG;  // Reads a value of type char.
char UC;  // Uppercase value of LG

TextIO.putln("Enter the letter grade do you want converted to point value?");
TextIO.putln();
TextIO.putln("A, B, C, D, or F");

LG = TextIO.getlnChar();
UC = LG.toUpperCase(); //this errors out 'char cannot be dereferenced'

switch ( LG ) {
case 'A':

Thanks for the direction.

  • 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-05-15T11:42:21+00:00Added an answer on May 15, 2026 at 11:42 am

    The toUpperCase method is one belonging to (at a minimum) the String or Character classes, you cannot execute it on a primitive char type. Try:

    LG = Character.toUpperCase(LG);
    

    See here for the gory details. Note particularly the shortcomings with respect to full Unicode support. You may be better of using strings instead although you should be okay with that sample code since you only allow A, B, C, D and F. What happened to E by the way?

    And, as Ben rightly mentioned in his answer, you should switch on the variable holding the uppercased character rather than the original. In my line above, that’s still LG since I see little reason for keeping the original.

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

Sidebar

Ask A Question

Stats

  • Questions 443k
  • Answers 443k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer When you're a DLL you can't directly control the apartment… May 15, 2026 at 6:14 pm
  • Editorial Team
    Editorial Team added an answer If you click the button to post back, then reload… May 15, 2026 at 6:14 pm
  • Editorial Team
    Editorial Team added an answer Your SQL query is wrong but the specific error you… May 15, 2026 at 6:14 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.