This site requires JavaScript, please enable it in your browser!
Greenfoot back
divinity
divinity wrote ...

2022/2/15

writing in red

divinity divinity

2022/2/15

#
hey pple, have a question, if you are building a program and you are testing it as you go along but when you run the program, some of the words are in the color red, can someone explain that to me, because I dont understand the reasoning behind it.. I didnt put any color in it, any explanation would be appreciate
danpost danpost

2022/2/15

#
Are you talking about the output (upper) part of the terminal window? Because, I believe, that should always be in black on white. However, some of the error output (lower) part may be colored red to reference those lines of code that you specifically wrote.
divinity divinity

2022/2/21

#
yes danpost, I am talking about the output which should be black but it some of it came out in red writing.
RcCookie RcCookie

2022/2/21

#
Red indicates errors. Writes with System.out will always be black, but if your code produces exceptions, they will be shown in System.err, which displays in red. You can also write in red manually by using System.err instead of System.out.
RcCookie RcCookie

2022/2/21

#
Error output should always have the form
…Exception…<Explanation>
    at <Class>.<Method> (<Line+Column number>)
    at <Class>.<Method> (<Line+Column number>)
    …
This is supposedly help you identifying the error. The top location line tells you the exact location where the exception occurred. It should be highlighted as a link and you can click on it which will redirect you to that place in your code. Common exceptions are: NullPointerException - trying to access a method of field from a null value ArrayIndexOutOfBoundsException - Trying to get an element from an array that is exceeds the array size of is negative IllegalArgumentException -You passed a non-valid argument to a method. Description will explain more. Example: negative Image size
You need to login to post a reply.