0

I just started learning Java as I'm being taught in school. I saw many people tell that IntelliJ is a great IDE for java, so to just try it I moved from BlueJ to IntelliJ.

One big problem I am facing is that in blueJ if I have to pass values to the program when it is running, BlueJ actually asks input before showing the output, and in the place of the String [] args I enter the values inside {} separated by commas.

But in IntelliJ it never asks for the values and directly shows an error that the index of the array specified doesn't exist.

Please help me how to solve this problem and be able to pass the values to the program...

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • To provide input you could use classes like `Scanner` or `Console` (ask for input) or pass the data as command line arguments (part of the startup command). It would help if you'd share some code to understand what problem you're facing. – Thomas Dec 01 '21 at 08:51
  • @PradeepSimha, thank you for suggesting but that is from eclipse and not from BlueJ, I hope you yourself read that one before suggesting! –  Dec 01 '21 at 08:52
  • Why do you people suggest eclipse when I'm asking when compared to blueJ? ? –  Dec 01 '21 at 08:53
  • Reading user input is an IDE-agnostic problem. Or at least, it should be, though I've seen questions in the past that indicate BlueJ does some special things. But in general, reading from the standard input stream is how you get input from the user. Prompt the user, scan the input stream for a response. That will block until there's data available to read. When connected to a console, _typically_ new data is available only once the user presses the enter key. – Slaw Dec 01 '21 at 08:56
  • @Slaw, thank you for your comment but I didn't understand what you are trying to explain,. –  Dec 01 '21 at 08:58
  • 1
    In short, what you did in BlueJ should work fine in IntelliJ (or Eclipse, or NetBeans, or any other IDE). If that's not the case for you, please [edit] your question to provide a [mre]. – Slaw Dec 01 '21 at 08:59
  • @Slaw, I understand that it should work fine but I feel IntelliJ is too complex for these king of simple things too! –  Dec 01 '21 at 09:01
  • IntelliJ isn't meant for simple things. If you want to do simple things, stick with BlueJ, it's meant for beginners. – Kayaman Dec 01 '21 at 09:02
  • Any IDE is going to have a learning curve, but BlueJ is designed for beginners so I would expect it to be easier to understand. – Slaw Dec 01 '21 at 09:02
  • 1
    You should not feel stupid. Downvotes are not a judgment on the person asking the question. But if your feelings are hurt by downvotes, complaining about it is not going to help. – Stephen C Dec 01 '21 at 09:04
  • In IntelliJ, there should be a "Run" tab that opens up (typically at the bottom of the IDE) when you run your project. That is where you'll see output from `System.out` and `System.err`. It is also where you can type input for your application, which can be read via `System.in`. – Slaw Dec 01 '21 at 09:07
  • @StephenC, I know you people may not like these silly question's, a friend of me told that down votes ban you from asking questions and later learning too –  Dec 01 '21 at 09:08
  • Only if you repeatedly ask questions that get downvoted. But you also need to be more strategic. And complaining about being "mistreated" when the downvotes are not about you is a really bad strategy. – Stephen C Dec 01 '21 at 09:11
  • Here is a link to IntelliJ's help pages: https://www.jetbrains.com/help/idea/2021.3/discover-intellij-idea.html. Though note that you may have to wade through information you don't want/don't understand yet to get to the information you do want. – Slaw Dec 01 '21 at 09:12
  • @StephenC, thanks –  Dec 01 '21 at 09:13
  • @Slaw, thank you for answering. Keeping the same as an answer would be great –  Dec 01 '21 at 09:14

0 Answers0