equivalent to push() or pop() for arrays?

In Java an array has a fixed size (after initialisation), meaning that you can’t add or remove items from an array. The above snippet mean that the array of integers has a length of 10. It’s not possible add an eleventh integer, without re-assign the reference to a new array, like the following: In Java … Read more

Java String to SHA1

UPDATEYou can use Apache Commons Codec (version 1.7+) to do this job for you. DigestUtils.sha1Hex(stringToConvertToSHexRepresentation) Thanks to @Jon Onstott for this suggestion. Old AnswerConvert your Byte Array to Hex String. Real’s How To tells you how. and (copied from Real’s How To) BTW, you may get more compact representation using Base64. Apache Commons Codec API 1.4, has this nice utility … Read more

What is the difference between JSF, Servlet and JSP?

JSP (JavaServer Pages) JSP is a Java view technology running on the server machine which allows you to write template text in client side languages (like HTML, CSS, JavaScript, ect.). JSP supports taglibs, which are backed by pieces of Java code that let you control the page flow or output dynamically. A well-known taglib is JSTL. JSP also supports Expression … Read more

difference between System.out.println() and System.err.println()

In Java System.out.println() will print to the standard out of the system you are using. On the other hand, System.err.println() will print to the standard error. If you are using a simple Java console application, both outputs will be the same (the command line or console) but you can reconfigure the streams so that for example, System.out still prints to the … Read more

Sending mail error, javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;

Error is self explainatory: javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25; You have no SMTP server on localhost, but you configure it there : So you must: either configure a local SMTP server as a relay on your local system (Postfix or sendmail are two well knows servers) of configure a dummy server that simply … Read more

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