• Register
1 vote
20 views

Problem:

Folks, I hope you are doing well. I started learning java programming very recently. I am on the chapter of Data Type right now of the book from where I am taking the help. There is a problem give in my book’s exercise that: “if you want to manually convert 65 to the letter a, what keyword is needed”?

I can’t really get the problem actually. Is it really possible to do so? If so, then how? Could you please give a hint regarding the problem given above?

Best regards.

12 7 7
15,250 points

Please log in or register to answer this question.

1 Answer

0 votes
 
Best answer

Solution:

Hello Gavin,

As I can understand you wanted to write a program where you can convert a number (65) into a letter (A) but you gave the title of your problem is, “Convert int to the string”

No worries. I am  trying to make it easy for both cases as following below:

public class IntToString 
{ 
  public static void main(String args[]) 
  { 
    int a = 65; 
    String s = Integer.toString(a); 
    System.out.println("String s = " + s);  
  } 
}

On the above code, I used the function Integer.toString() it helps to cast an integer number into a string type.

public class IntToChar
{
  public static void main(String args[])
  {
    int a1 = 65;          
    char ch = (char) a1;
    System.out.println("Integer value: " + a1);
    System.out.println("Char value: " + ch);
  }
}

I really hope it might help you.

13 9 6
94,240 points

Related questions

0 votes
1 answer 10 views
1 vote
1 answer 201 views
201 views
Problem: I am looking for a solution to my existing code. Well, I am a new student of java. I was thinking about a program that can check whether the given char is an upper case or not! Let’s say I’ve given a char as ‘a’ and I want ... , my question is, how to check whether a char variable ch is an uppercase letter, you write? Thanks for your valuable time and effort guys.
asked Mar 22, 2020 Gavin 15.3k points
0 votes
1 answer 15 views
15 views
Problem Hey, I was writing a program that was too big then I realized. If I convert that string into double that will be great for me to write the program but I Am not familiar with this concept of conversion of string into double. Someone can help for accomplishment of this work.that will be great for me.
asked Dec 23, 2020 chris jordan 2.2k points
0 votes
1 answer 6 views
0 votes
1 answer 11 views
11 views
I want a program that will help me to copy one file to another file in Java.
asked Sep 22, 2020 Daniel Anderson 4k points
0 votes
1 answer 7 views
7 views
Problem Hey, i want to know that, how to how to convert string into uppercase
asked Dec 23, 2020 chris jordan 2.2k points
0 votes
1 answer 20 views
20 views
Problem Hey, I want to send a string to my serial. Once If I get the string or array, how can I convert my string into float value? Answer me in easy-to-understand manner as possible as you can.
asked Dec 23, 2020 chris jordan 2.2k points
0 votes
1 answer 9 views