Category: Java

String vs StringBuffer vs StringBuilder in Java

What are the differences of String, StringBuffer, and StringBuilder in Java? When we talk about Strings, we’re typically referring to instances of joined¬†characters. Strings can be created with the declaration of String or generating an instance of a StringBuffer or StringBuilder in Java. String String example = “example”; If we want to change example, we lose the reference to the original object. Each modification of a String creates a new instance of the String in Java. example += ” added”;...

More

How to Connect to MySQL with Java JDBC driver

This article will go over how to connect to MySQL with the Java JDBC driver. The tutorial will go over step-by-step on how to make your first connection with the Java JDBC driver to MySQL and get started. Installation of MySQL For starters, you must have MySQL on your machine. To install MySQL, you can easily use the following command on Ubuntu or Debian machines: sudo apt-get install mysql-server sudo apt-get install mysql-client sudo mysql -u root -ppassword   Create...

More