Java util.Arrays Class

When you write a program, most of the time you come across to use arrays. In most cases you are just rearranging the array. Guess what, Java has a complete set of functions to do anything you need to do to an array. It is in the "arrays" class in the java.util package. Well, I... Continue Reading →

Advertisements

Primitives

Java primitives is a special sub set of java data types. They are the foundation of storing data in a program. Considering each primitive, there are two things to consider about. First what kind of a value you would store in it and second what is the memory size it would take in the computer... Continue Reading →

StringBuilder Class

Let's find out what is the difference between the normal string class and this new class (StringBuilder). You can also check out my tutorials on String class from here (part 1 / part 2). You should know that the string class we normally us is an immutable character string which means the string we create... Continue Reading →

Methods of the String Class (Part 2)

This is the continuation of the previous part of Methods of the String Class (Part 1) . This the part 2 of that tutorial. Hope you enjoyed it and let's get started. The substring method returns new strings that are sub strings (parts) of the referred string (original String) object. this method requires two parameters. originalString.substring(startingIndex, endIndex) the... Continue Reading →

Methods of the String Class (Part 1)

There are some functions that are related to the String class so that we can easily work with the strings that we make in the code. The indexOf Method Returns the index of the character in the string in the form of an integer. There are 4 types of indexOf methods. indexOf ( char ) only... Continue Reading →

String Concatenation

String concatenation is the process where we add 2 strings to make up a new string. This can be done using the addition operator ( + ). For instance : String firstName = "Lahiru"; String lastName = "Hashan"; String name = firstName + lastName; check out the output : Output : LahiruHashan No space because... Continue Reading →

Operators in Java

Following will be covered in this tutorial. Assignment Operators Arithmetic Operators Relational Operators Logical Operators Assignment Operators Assignment operators are used to assign values to variables.      =            Assignment operator For example : int number = 10; boolean isInteger = true; TextField textInput = new TextField(); Important : The... Continue Reading →

Iteration Statements

Java has got 4 main types of iterative statements. FOR LOOP ENHANCED FOR LOOP WHILE LOOP DO-WHILE LOOP For Loop Keywords : for, break, continue Example : for (int i = 0 ; i <= 10 ; i++) { System.out.println(i); } Enhanced For Loop Keywords : for, break, continue This is used when interacting with... Continue Reading →

Create a free website or blog at WordPress.com.

Up ↑