assertion question


class Language{
    public static final int java=1;
    public static final int pascal=2;
    public static final int csharp=3;

}
public class Mgos  {
    static int lang=0;
    public static void main(String argv[]){
        switch(lang){
        case Language.java:
            System.out.println("java");
            break;
        case Language.pascal:
            System.out.println("pascal");
            break;
        case Language.csharp:
            System.out.println("csharp");
            break;
        default:
            assert false : lang;
        }

    }

}

I was trying above example from link

http://www.jchq.net/certkey/0205certkey.htm

did not understand output while running in eclipse ide.

I was trying to understand the output. Wow can i pribt say java to the console.


 Any links, ideas, resources,sample code highly appreciated. thanks in advance.
LVL 7
gudii9Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
That won't do anything unless  you run it with assertions enabled, in which case it will print 0
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mick BarryJava DeveloperCommented:
It will not output anything
the value of lang is 0 which does not match any of the switch cases so the default gets executed.
the assert is ignored as assertions are not enabled

0
gudii9Author Commented:
>>>That won't do anything unless  you run it with assertions enabled, in which case it will print 0

I am getting message on console like

>>Exception in thread "main" java.lang.AssertionError: 0
      at com.vaannila.student.Mgos.main(Mgos.java:23)

after enabling assertion in eclipse ide and ran as java application.

Are you referring to same '0'.

How can i get something like java or pascal. please advise
0
Mick BarryJava DeveloperCommented:
>     static int lang=0;


change that to:


    static int lang=1;
0
gudii9Author Commented:
sure. i will try
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.