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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:21:32+00:00 2026-06-14T17:21:32+00:00

How can I convert an int to char? I am using: int i=20; char

  • 0

How can I convert an int to char?

I am using:

int i=20;
char c= Character.forDigit(i,10);
// OR
//char c= Integer.toString(i).charAt(0); 

System.out.println(c);
  1. I want char as ’20’ (NOT to treat 20 as ASCII value and printing some char whose ASCII is 20).
  2. The above program works fine for single digit but for double digit like 20, it prints only first character, 2.

How can I print 20 as a whole?

  • 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-14T17:21:33+00:00Added an answer on June 14, 2026 at 5:21 pm

    A char is a single character, that is a letter, a digit, a punctuation mark, a tab, a space or something similar. A char literal is a single one character enclosed in single quote marks like this

    char myCharacter = ‘g’;

    Some characters are hard to type. For these Java provides escape sequences. This is a backslash followed by an alphanumeric code. For instance ‘\n’ is the newline character. ‘\t’ is the tab character. ‘\’ is the backslash itself. The following escape sequences are defined:

    \b backspace
    \t tab
    \n linefeed
    \f formfeed
    \r carriage return
    \” double quote, ”
    \’ single quote, ‘
    \ backslash, \
    The double quote escape sequence is used mainly inside strings where it would otherwise terminate the string. For instance

    System.out.println(“And then Jim said, \”Who’s at the door?\””);
    It isn’t necessary to escape the double quote inside single quotes. The following line is legal in Java

    char doublequote = ‘”‘;

    To convert into String:
    String.valueOf(20);

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

Sidebar

Related Questions

You can convert a negative number to positive like this: int myInt = System.Math.Abs(-5);
I can't convert ds.Tables[1].Rows[0].ToString() to an int. ds.Tables[1].Rows[0] = 100; Gives an error can't
Using C++, an int gets converted from "signed" to "unsigned". Can I convert this
How can I convert a string using the toupper function? This did not work.
Possible Duplicate: How can I convert String to Int? public List<int> GetListIntKey(int keys) {
How can I convert from bytes to float in php? Like in Java int
can you guys help to convert a JPG File into an 2-dimensional int []
convert this: $300 to this : 300 can't do it with intval() or (int)
I have a function to convert integer to string .The function is char *
I want to convert the string to character array. Further, the values in character

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.