Ugur Aydın Ugur Aydın - 7 months ago 15
Java Question

I javac my program on console but it didn't work(Linux)

I'm new at Java and I have a question.

I wrote this code.

{string isim = "Ali";boolean özne == true;if ( özne ){ System.out.println("Merhaba" + isim); }}}

When I javac it in console, it says: error: ';' expected
boolean özne == true;
1 error

What I need to do to fix this?

Please HELP ME!!!


Use = instead of == to affect true to your boolean variable, and the correct spelling for the class string is String.

You will also need to declare your class, I don't see it in your code snippet but in your case it should be something like that knowing that the name of your file is

public class Muz {
    public static void main(String[] args) {
        String isim = "Ali";
        boolean özne = true;
        if ( özne ){ 
            System.out.println("Merhaba" + isim);