Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
  1. Your Java code is working fine. It just happens to output some messages when running.

If you change line 5 to

System.out.println("ANSWER: " + istPalindrom(warray));"

you will see more clearly what the output is and that it is the output.

  1. Syntax highlighting:

Is there a way to enable the edditor to recognise java use some highlights

The editor works fine and highlights the java code properly. I don't know why you would think it doesn't. That said, the share serve evidently does NOT properly syntax highlight anything (what you linked to above), which is a bug that I've reported: https://github.com/sagemathinc/cocalc/issues/2705

And: 3. Running Java code?

Your question is about running Java code, from what I understand, either in a Jupyter worksheet (.ipynb) or in a CoCalc worksheet (.sagews).

No - this has nothing to do with Jupyter or Sage or Sage worksheets. CoCalc has its own (secret, not advertised) side-by-side editor, where you type Java on one side, and when you save it compiles and runs it -- sort of like LaTeX.