Java Program to Find ASCII Value of a character

Example: Find ASCII value of a character
public class AsciiValue {

    public static void main(String[] args) {

        char ch = 'a';
        int ascii = ch;
        // You can also cast char to int
        int castAscii = (int) ch;

        System.out.println("The ASCII value of " + ch + " is: " + ascii);
        System.out.println("The ASCII value of " + ch + " is: " + castAscii);


The ASCII value of a is: 97
The ASCII value of a is: 97
[mai mult...]

Java Program to Print an Integer (Entered by the User)

Example: How to Print an Integer entered by an user:
import java.util.Scanner;

public class HelloWorld {

    public static void main(String[] args) {

        // Creates a reader instance which takes
        // input from standard input - keyboard
        Scanner reader = new Scanner(;
        System.out.print("Enter a number: ");

        // nextInt() reads the next integer from the keyboard
        int number = reader.nextInt();

        // println() prints the following line to the output screen
        System.out.println("You entered: " + number);


Enter a number: 10
You entered: 10
[mai mult...]

Create a lap timer with Python

The user needs to press ENTER to complete each lap. The timer keeps counting till CTRL+SHIFT is pressed.For each lap we calculate the lap time by subtracting the current time from the total time at the end of the previous lap. The time() function of the time module, returns the current epoch time in milliseconds.

[mai mult...]

Delete a file with Python

To delete a file with this script, we can use the os module.It’s recommended to check with a conditional if the file exist before calling the remove() function from the module:

import os

if os.path.exists("<file_path>"):

[mai mult...]

Write to a File in Python

To replace the content completely, we use the "r" mode, so we pass this string as the second argument to open(). We call the .write() method on the file object passing the content that we want to write as argument.

For example:

words = ["Blue", "Amazing", "Python", "Code"]

with open("famous_places.txt", "r") as file:
    for word in words:
        file.write(word + "\n")
[mai mult...]