15th Jan 2020, 8:58 AM
Prashant Shukla
Prashant Shukla - avatar
12 ответов
+ 1
Mention you doubt clearly... In Main method declaration you missing String array[] as method argument.. See this... https://www.sololearn.com/learn/Java/2137/ And use break statements after every case.. Other wise next cases also get executed...
15th Jan 2020, 12:53 PM
Jayakrishna 🇮🇳
+ 1
Prashant Shukla BlueJ is a development environment which is a deliberately smaller and simpler interface than professional environments like NetBeans or Eclipse. This allows beginners to get started more quickly and hence doesnt force you to write the main() instead it does it for you in the background https://www.cs.utexas.edu/users/scottm/cs307/handouts/BlueJProjectInstructions.html Where as Netbeans and Eclipse mandate that you type code manually rather than use a drag and drop approach which is there in BlueJ. Having said that public static void main(String[] arg){...} is the starting point for a standard standalone program.
15th Jan 2020, 1:25 PM
Jayakrishna 🇮🇳
0
Sorry but string args is not necessary as it is needed when we create object
15th Jan 2020, 12:57 PM
Prashant Shukla
Prashant Shukla - avatar
0
But you need in for main method. The main method is the starting point of execution. After starting main method you can create object. Otherwise you can't, because your Program goes for compilation but not for execution...
15th Jan 2020, 1:00 PM
Jayakrishna 🇮🇳
0
Bro I have done a lot of coding in bluej and I was in habit of not writing string args and never got error I want to know why I am getting error here Secondly I want to know if I can write infinite loop here
15th Jan 2020, 1:07 PM
Prashant Shukla
Prashant Shukla - avatar
0
There it implicitly adds main method in the background by application. So it calls that method... Here you can't.. Infinite loop means? As in your program, it accepts inputs until you input a==0 fails... It is Infinite only.. Are you getting desired output for your program?
15th Jan 2020, 1:13 PM
Jayakrishna 🇮🇳
0
No is not getting desired results This program is meant to enable us to rerun program directly from input window without having to run it again from main window
15th Jan 2020, 1:18 PM
Prashant Shukla
Prashant Shukla - avatar
0
Here, You can enter all the required inputs only ones.. It does not call input console again.. So you need inputs like this.. Ex: 3 2 2 2
15th Jan 2020, 1:32 PM
Jayakrishna 🇮🇳
0
Okk thanks
15th Jan 2020, 1:41 PM
Prashant Shukla
Prashant Shukla - avatar
0
I understood that it is not It is not like other ide's and we can not run a infinite loop which can get input again in real runtime Thanks
15th Jan 2020, 1:42 PM
Prashant Shukla
Prashant Shukla - avatar
0
You can but in a way that, give all n' inputs at ones only by space separated which you give in other IDEs n' inputs one after one like a real time. Wel come.
15th Jan 2020, 1:48 PM
Jayakrishna 🇮🇳
0
Thanks for help
16th Jan 2020, 2:55 AM
Prashant Shukla
Prashant Shukla - avatar