skb29 skb29 - 4 months ago 28
Java Question

SUBLIME TEXT 3 JAVA BUILD RESULT NOT WORKING

I have a problem in sublime text 3. After successful build i am not getting output . even build result is not working for hello world java program and no output please help me
enter image description here

import java.io.*;
class h{
public static void main(String args[]){
System.out.println("Hello World"); }}

Answer

Building means you now have a program. In order to get output, you have to run it. To run it, find your h.class file and run:

java h

This should print the message you're looking for.

Also if you're having this sort of basic problem, it helps to narrow things down to figure out where the problem is coming from. For example you could have first tried without using Sublime Text at all, like this:

$ javac h.java
(nothing is printed but you should now have a h.class file)
$ java h
Hello World

If nothing else, this would make for a better StackOverflow question.

Comments