#Why does this not compile

7 messages · Page 1 of 1 (latest)

pastel pasture
#
public class Interaction {
  public static void main(String[] args){
    char myUnicodeChar = 'U+003F' , mySimpleChar = '?' , myDecimalChar = '63';
    System.out.println(myDecimalChar + mySimpleChar + myUnicodeChar);



  }
}
azure rampartBOT
#

This post has been reserved for your question.

Hey @pastel pasture! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

hushed igloo
#

'x' is the literal notation for a character. the contents can only be a single character or an escape sequence.

for the third one, just remove the quotes, you want the plain number there.
for the first one, you could either use a hexadecimal number, or you could use the proper escape, '\u003F'. U+XXXX isn't valid syntax in code.

azure rampartBOT
# pastel pasture thank you bro

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

pastel pasture
#

understood