Results 1 to 13 of 13
Thread: Can't See the output
- 02-28-2011, 09:10 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 38
- Rep Power
- 0
Can't See the output
I have wrote my program on Notepad++.
Now when i am trying to compile my program through command prompt it is compiling but when i am trying to run the program i am not getting any output while the notepad on which i have wrote the program is getting displayed
Please help me out what is the problem
- 02-28-2011, 09:15 AM #2
How would we know unless you show us what have you written?
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 02-28-2011, 10:33 AM #3
Member
- Join Date
- Feb 2011
- Posts
- 38
- Rep Power
- 0
This is the code i have written
//Demonstrate Method Overloading.
class OverloadDemo
{
void test()
{
System.out.println("No parameters");
}
//Overload test for one integer parameter.
void test(int a)
{
System.out.println("a: " + a);
}
//Overload test for two integer parameters.
void test(int a,int b)
{
System.out.println("a and b: " + a + " " + b);
}
//Overload test for double parameter
double test(double a)
{
System.out.println("double a:" + a);
return a * a;
}
}
class Overload
{
public static void main(String args[])
{
OverloadDemo ob = new OverloadDemo();
double result;
//call all versions of test()
ob.test();
ob.test(10);
ob.test(10,20);
result = ob.test(123.2);
System.out.println(result);
}
}
- 02-28-2011, 10:34 AM #4
Member
- Join Date
- Feb 2011
- Posts
- 38
- Rep Power
- 0
Now when i am compiling this program it's showing no errors,but while running the notepad containing the code is getting displayed
- 02-28-2011, 10:45 AM #5
Well, your code ran fine with me.
What are the command line arguments you are using to compile and run this?
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 02-28-2011, 10:46 AM #6
Member
- Join Date
- Feb 2011
- Posts
- 38
- Rep Power
- 0
To compile i am using
javac <programname>.java
and to run
<programname.java
- 02-28-2011, 10:48 AM #7
You should use,
To Compile: javac Overload.java
To Run: java Overload
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 02-28-2011, 10:51 AM #8
Member
- Join Date
- Feb 2011
- Posts
- 38
- Rep Power
- 0
But the name of my class is OverloadDemo so i have saved it wiith the same name
Now if i tried to execute it as you specified it's throwing an error of file not found
- 02-28-2011, 10:53 AM #9
Member
- Join Date
- Feb 2011
- Posts
- 38
- Rep Power
- 0
I think i have to save it with the class name that contains main method-- Is it
- 02-28-2011, 10:55 AM #10
Member
- Join Date
- Feb 2011
- Posts
- 38
- Rep Power
- 0
But still its showing the same notepad
- 02-28-2011, 10:56 AM #11
Yeah. You are supposed to run the java file that contains the main method. In your case it is, Overload.java
If you try to use java command on file with no main method, there will be error saying, "NoSuchMethodError: main"
I hope you are clear with that,
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 02-28-2011, 10:58 AM #12
Member
- Join Date
- Feb 2011
- Posts
- 38
- Rep Power
- 0
Got it
I was doing a mistake
For running i was using Overload java
now by java Overload it worked fine
Thanks a lot for your help,,thanks
- 02-28-2011, 11:01 AM #13
You are Welcome. :D
Go through this simple tutorial which will help you understand the things in much clear way : Hello World
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
Similar Threads
-
how to get the resultset output into an output file
By renu in forum New To JavaReplies: 0Last Post: 09-30-2010, 08:16 PM -
Why do I get this output?
By Allspark in forum New To JavaReplies: 3Last Post: 09-23-2010, 08:07 AM -
Can anyone tell me how this output?
By vysh in forum Advanced JavaReplies: 16Last Post: 05-10-2009, 08:32 PM -
Java, output string, getting correct output? HELP!
By computerboyo in forum New To JavaReplies: 2Last Post: 02-25-2009, 11:44 PM -
how to c the output
By pro85 in forum Java AppletsReplies: 1Last Post: 02-11-2009, 09:09 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks