- 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.
- 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...
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.
It is hard to understand / reconstruct the situation / the question.
The link points to some java code for some Aufgabe1 that can be easily solved in python (and sage), e.g. also with test code to find the palindroms in some test list:
(Sure, this was not the point.)
How to run the above code (not in eclipse), and how is this related to sage? When does the error appear? How is this related to sage? Is the only question asking for Cocalc java code highlight?
Cocalc opens for me some editor with the java-like highlighted code after pressing the [Open in Cocalc] from the given link.
Its just one line....well i can make it look nice! :) Okey more explanition: sage can run java,phython,c++,fortran, and god knows what else! I have tried java and i get a warning. , so what does this means
Your question is about running Java code, from what I understand, either in a Jupyter worksheet (.ipynb) or in a CoCalc worksheet (.sagews). You could request help by clicking the "Help" button (emergency suitcase icon) at the top right of a CoCalc browser window. Make sure to click that button from the worksheet or file where you are experiencing the problem, this way the support team at CoCalc can access that particular worksheet or document and see what the problem is.
I don't see how this relates to Sage, so maybe I'm missing your question. The CoCalc editor recognizes the .java filetype and will do syntax highlighting without additional setup. Is that your question? For example in a .term at the command line, you could type "open Aufg1.java" to get an editor tab.
You can compile and run the file from the command line, but I think you may have already have done that. A CoCalc .term is a bash session into an Ubuntu container where java runtime is already installed. More info at the CoCalc wiki: https://github.com/sagemathinc/cocalc/wiki/Programming#java-prog (https://github.com/sagemathinc/cocalc...)