0

Background:

I am trying to learn java and wanted to try out printing hello world as my first program, and asked my friend to send one to me. He said I was lazy and didn't want to do the work, but he did send me one program, reluctantly.

This is the code he sent.

public class af {
    public static void mаin(String [] args) {
        System.out.println("Hello World!");
    }
}

What I tried: I cut&pasted it into gvim, but I get the following error when I try to run it (it compiles fine).

Error: Exception in thread "main" java.lang.NoSuchMethodError: main

But, when I actually do the work of typing it out (as he wanted me to), it works!

The question:

How does this work?

BoltClock
  • 630,065
  • 150
  • 1,295
  • 1,284
Knoothe
  • 1,208
  • 8
  • 14

1 Answers1

3

I attempted to paste this into my IDE, and it pointed out to me that

Some characters cannot be mapped using "Cp1252" character encoding.

It highlighted the character that could not be mapped, and it highlighted the "a" in public static void main

After changing the а to a normal a, the code worked fine.

The a must be some sort of different character that looks like an a. Try typing in the a again and trying again.

nasonfish
  • 295
  • 1
  • 3
  • 13