Home

Primitive Data Types in Java

Data types define and restrict the type of values that can be stored in the variables. Java has the following 8 primitive data types: Int - The Int or the Integer data type is a 32-bit signed two's complement integer. Int data type can only hold whole numbers ranging from -2,147,483,648 to 2,147,483,647. Default value for an... Continue Reading →

Linked List: JAVA

What is a LinkedList? Linked List (LL) is a data structure where each element links to the next element Element in Linked List are not indexed so to access an element you have to start from the head and work your way through to the required element LL is quite slow for retrieving data (Point 2) but... Continue Reading →

Reverse a String in JAVA

Create a function reverseString which takes a String as a parameter and prints out the string in reverse order Initialize a variable named reverse to hold the reversed String inside the reverseString1 method Create a for loop starting from the last index of the string passed to the method to 0. Last index is (length of the... Continue Reading →

Running a JAVA program from Terminal on Mac

Run Terminal on Mac by pressing command+spacebar and typing in Terminal in the search bar On terminal change directory to where you saved your java file (file with .java extension) by using the “cd” command on terminal You can list the content of a folder using “ls” command Compile java file using the following command user$... Continue Reading →

Blog at WordPress.com.

Up ↑