charAt error “char cannot be converted to string”

currLet = str.charAt(currPos); A String value can’t be assigned to a char, they are different types, apples and oranges if (currLet = str.charAt(currPos + 1)) { is actually an assignment (make currLet equal to the value of str.charAt(currPos + 1)) if (currLen > maxLen) { – maxLen is undefined You never return anything from the method… Try changing: String currLet = “”; to something more like char currLet = ‘\0’; and String … Read more

How to get Java to wait for user Input

There is no need for you to check for available input waiting and sleeping until there is since Scanner.nextLine() will block until a line is available. Have a look at this example I wrote to demonstrate it: Please input a linehelloWaited 1.892s for user inputUser input was: helloPlease input a line^DSystem.in was closed; exiting So all you … Read more

String is immutable. What exactly is the meaning?

Before proceeding further with the fuss of immutability, let’s just take a look into the String class and its functionality a little before coming to any conclusion. This is how String works: This, as usual, creates a string containing “knowledge” and assigns it a reference str. Simple enough? Lets perform some more functions: Lets see how the below statement works: This appends a … Read more

What exactly is Ajax request? Is it different from Servlet Request?

An Ajax call is an asynchronous request initiated by the browser that does not directly result in a page transition. A servlet request is a Java-specifc term (servlets are a Java specification) for servicing an HTTP request that could get a simple GET or POST (etc) or an Ajax request. An Ajax (“Asynchronous Javascript and … Read more

Creating video player using Java

I used vlcj and it worked smoothly. It’s java binding to vlcj player and the good thing that you don’t have to provide any drives since vlcj already includes all of them in binary distribution. Give it a go, there is example of already working player built for you!

Increase heap size in Java

You can increase to 2GB on a 32 bit system. If you’re on a 64 bit system you can go higher. No need to worry if you’ve chosen incorrectly, if you ask for 5g on a 32 bit system java will complain about an invalid value and quit. As others have posted, use the cmd-line flags – e.g. You … Read more

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