• Post Reply Bookmark Topic Watch Topic
  • New Topic

Another DooBee Question. (sorry)  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's my code: (from vi editor, on Ubuntu OS)



No errors when compiling. When I run java DooBee shows nothing. just comes back to prompt.
Thanks
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove DooBee.class, compile and try again because this should output something.
 
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i get "DooBeeDooBeeDo" as the output.
 
Roberto Cheritaz
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I removed DooBee.class, recompiled, still no results when I ran java DooBee. The very first code I wrote from the Head First book - called MyFirstApp.java compiled and and ran fine. Thanks for your time and patience.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know anything about Ubuntu... Does your other program still work? do you get ANYTHING? When you type

java DooBee

on the command line, what exactly DOES it do - just come back to a new prompt?
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe a very stupid idea but did you save the java file?
 
Roberto Cheritaz
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it just comes back to the command line after i run java DooBee

Yes, my 1st java program MyFirstApp works fine.
 
Roberto Cheritaz
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To answer Wouter Oet's question, yes, I saved the file DooBee.java I compiled it and DooBee.class was created. From the command line, I run java DooBee and it just comes back to the prompt with no results, no errors, nothing.

Is there an issue with syntax as far as spaces are concerned? For example, I have int x=1; but should it really be init x = 1;

thanks!
 
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whitespace is optional in a lot of cases, so as far as the compiler is concerned the two are equal. From an aesthetic point of view adding the spaces looks better to me and many, many others, so you may want to start doing that. But that's not what is causing the problems.
 
Roberto Cheritaz
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured out my issue and am completely embarrassed. This was completely a programmer error. The output was appearing before my prompt, and for some reason I failed to notice it...

username@cheetah2:~/java-stuff$ java DooBee
DooBeeDooBeeDousername@cheetah2:~/java-stuff$

I changed the code and put a \n after "Do"

System.out.print("Do\n");


ugh... sorry all, and again thanks for your patience.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!