Java 5. Variables

What am I doing wrong here?

U were asked to only set the values for the variables of these different datatypes. look at my screenshot!!

Hello, I have the same dificulty, I try to do what you post here, but this is what I got… What I’m doing wrong? Can you help me? Thank for your attention.

reload your page and try once again… or try the same code in some other IDE or notepad and run it individually… you wont get the same error. Its mentioned that you wer trying to convert a string to a character datatype, but string is nothing but a sequence of characters either constant or variable… i am just a beginner… what i would suggest you is get a friend who can help you with these things or go and find out from some other forum in the internet… I feel that your code is error free.

First, try taking out line 6 until you get the green check for line 5.

This is what you need to do.

look at your code again.

char movieRating=“A”;

(" ") are used for strig functions like (“This is fun!”)
you need to repleace " " with ’ ’ which equal char.


Could you please explain it to me why did we have to insert System.out.println and the variables myNumber, isFun, movieRating after every data type?
My code was also invalid before I copied what you wrote, so I get it - this is the right way to do it, but I would still like to understand this task before proceeding to the next one.

Sorry if the question is stupid, but this is my first contact with Java in general (literally first 10 minutes) :smiley:

Thank you in advance!

you are asked to set the variable ‘myNumber’ which is an ‘integer’ to set the value of the variable to 42

public class DataTypesc
public static void main(String args[])
int myNumber =42;
System.out.println("the number is = " + myNumber);

type this!!! it might help u…