What is a classpath and how do I set it?

When programming in Java, you make other classes available to the class you are writing by putting something like this at the top of your source file: Or sometimes you ‘bulk import’ stuff by saying: So later in your program when you say: The Java Virtual Machine will know where to find your compiled class. … Read more

getting error HTTP Status 405 – HTTP method GET is not supported by this URL but not used `get` ever?

The problem is that you mapped your servlet to /register.html and it expects POST method, because you implemented only doPost() method. So when you open register.html page, it will not open html page with the form but servlet that handles the form data. Alternatively when you submit POST form to non-existing URL, web container will … Read more

What are all the escape characters?

You can find the full list here. \t Insert a tab in the text at this point. \b Insert a backspace in the text at this point. \n Insert a newline in the text at this point. \r Insert a carriage return in the text at this point. \f Insert a formfeed in the text … Read more

What does “|=” mean? (pipe equal operator)

|= reads the same way as +=. is the same as where | is the bit-wise OR operator. All operators are referenced here. A bit-wise operator is used because, as is frequent, those constants enable an int to carry flags. If you look at those constants, you’ll see that they’re in powers of two : So you can use bit-wise OR to … Read more

Change date format in a Java string

Use LocalDateTime#parse() (or ZonedDateTime#parse() if the string happens to contain a time zone part) to parse a String in a certain pattern into a LocalDateTime. Use LocalDateTime#format() (or ZonedDateTime#format()) to format a LocalDateTime into a String in a certain pattern. Or, when you’re not on Java 8 yet, use SimpleDateFormat#parse() to parse a String in a certain pattern into a Date. Use SimpleDateFormat#format() to format a Date into a String in a certain pattern. See also: Java string to date … Read more

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