FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
01-Core-Java/08-Java-Programs/019-Find-ASCII-Value.java at main · shaikbasha-dev/01-Core-Java · GitHub
shaikbasha-dev
/
01-Core-Java
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
01-Core-Java
/
08-Java-Programs
/
019-Find-ASCII-Value.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
71 lines (57 loc) · 2.36 KB
Breadcrumbs
01-Core-Java
/
08-Java-Programs
/
019-Find-ASCII-Value.java
Copy path
File metadata and controls
71 lines (57 loc) · 2.36 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* ============================================================================
* Program Name : Find ASCII Value
* File Name : 019-Find-ASCII-Value.java
* Class Name : FindASCIIValue
*
* Description:
* This program demonstrates how to find the ASCII value of a character
* in Java. Every character is internally represented by a numeric value
* based on the ASCII (American Standard Code for Information Interchange)
* character set for standard characters.
*
* Objective:
* - Understand the relationship between characters and their ASCII values.
* - Learn how implicit type conversion converts a char into an int.
* - Display the ASCII value of a given character.
*
* Author : Shaik Mahaboob Basha
* Repository : 01-Core-Java
* Folder : 08-Java-Programs
* ============================================================================
*/
public
class
FindASCIIValue
{
// The main() method is the entry point of every Java application.
public
static
void
main
(
String
[]
args
) {
// Declare and initialize a character variable.
char
character
=
'A'
;
// Convert the character to its ASCII value using implicit type casting.
int
asciiValue
=
character
;
// Display the character.
System
.
out
.
println
(
"Character : "
+
character
);
// Output: Character : A
// Display the ASCII value.
System
.
out
.
println
(
"ASCII Value : "
+
asciiValue
);
// Output: ASCII Value : 65
// Display another example using a lowercase character.
char
lowerCaseCharacter
=
'a'
;
// Convert the lowercase character to its ASCII value.
int
lowerCaseASCII
=
lowerCaseCharacter
;
// Display the lowercase character.
System
.
out
.
println
(
"
\n
Character : "
+
lowerCaseCharacter
);
// Output: Character : a
// Display its ASCII value.
System
.
out
.
println
(
"ASCII Value : "
+
lowerCaseASCII
);
// Output: ASCII Value : 97
// Display another example using a digit.
char
digit
=
'5'
;
// Convert the digit to its ASCII value.
int
digitASCII
=
digit
;
// Display the digit.
System
.
out
.
println
(
"
\n
Character : "
+
digit
);
// Output: Character : 5
// Display its ASCII value.
System
.
out
.
println
(
"ASCII Value : "
+
digitASCII
);
// Output: ASCII Value : 53
}
}
Back
|
FazBrowse Home
|
New Git URL