Java Examples

100+ tutorials, source code, and examples to help you develop creative and technical skills.

Java Program to get ASCII value of a Character

AsciiValue.java

import java.util.Scanner;

/* Code From Learnoset - Learn Coding Online.
    Download Learnoset App from PlayStore to learn coding,
    projects, algorithms, error handling
 */

// Java Program to get ASCII value of a Character

public class AsciiValue {
    
	public static void main(String[] args) {
        
		// create Scanner class object to get input from user
        Scanner scanner = new Scanner(System.in);
		
        System.out.println("Enter a number:");
		
        //get user's enetered value from 'scanner' object into 'character' variable
        char character = scanner.next().charAt(0);
		
		// get ascii value from 'character' and store it into 'asciiValue'
		int asciiValue = character;
		
		System.out.println("The ASCII value of " + character + " is: " + asciiValue);		
		
    }
}

Projects with Source Code + Video Tutorials

You can download our Java and Android Studio Projects with Source Code and Video Tutorials.

Snake-game-android-studio-source-code
Snake game android studio source code
Complete-Chat-Application-Using-Firebase-Database
Complete Chat Application Using Firebase Database
Settings-and-Profile-page-UI-design-in-Android-Studio-with-Example-and-Source-Code
Settings and Profile page UI design in Android Studio with Example and Source Code

If you have any Questions or Queries
You can mail us at info.learnoset@gmail.com

Follow us to learn Coding and get in touch with new Technologies.