compilation error: identifier expected

You have not defined a method around your code. In this case, I have assumed that you want your code to be executed in the main method of the class. It is, of course, possible that this code goes in any other method.

Why cannot cast Integer to String in java?

Why this is not possible: Because String and Integer are not in the same Object hierarchy. The casting which you are trying, works only if they are in the same hierarchy, e.g. In this case, (A) objB or (Object) objB or (Object) objA will work. Hence as others have mentioned already, to convert an integer to string use: String.valueOf(integer), or Integer.toString(integer) for primitive, … Read more

how to convert .java file to a .class file

A .java file is the code file. A .class file is the compiled file. It’s not exactly “conversion” – it’s compilation. Suppose your file was called “herb.java”, you would write (in the command prompt): It will create a herb.class file in the current folder. It is “executable” only if it contains a static void main(String[]) method inside it. If it does, … Read more

what does x– or x++ do here?

x– will decrement value of x by 1. It is a postfix decrement operator, –x is a prefix decrement operator. So, what’s going on here? By analogy, the ++ will increase a value by 1. It also has a prefix and postfix variant.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)