Using ternary operator in Strings in Java

ternary operator String java

We can use ternary operator in java to find singular or plural value as below. Here basket is a l ... Read More

Writing to a text file using Java

FileWriter I/O java

Below is an example of writing to the text file using FileWriter class Note that we have added ... Read More

class equals and hashcode in Java

class equals hashcode java

We have seen in out Sets example that if we add two user defined class objects of class Planet to th ... Read More

Naming conventions in java

naming conventions java

* Package names should always be lowercase. If domain name contains a java keyword or contains a - ... Read More

Another group pattern example in java

Another group pattern example java

We know that we can use group patterns to print the occurence of a particular pattern in a String. W ... Read More

Reading contents of directory(only files and not directories within directory) in java

Reading contents of directory(only files and not directories within directory) java

If we want to print only files and not the directory we can do something like below We make a fi ... Read More

Walking down a file tree using SimpleFileVisitor to copy complete directory contents in java

Walking down a file tree using SimpleFileVisitor to copy complete directory contents java

* Let see how to copy file named File1.txt from Dir3 directory in Dir2 to a folder named Dir3 wihin ... Read More

Four main concepts of OOP

4 concepts java

Four main concepts of Java or any other Object oriented programming language are 1. Abstraction ... Read More

Buffered writer in java

buffered writer java

We can even use Buffered writer . File writer writes data to Buffered writer and the buffered write ... Read More

Moving,renaming a deleting a file in java

Moving renaming a deleting a file java

Code to move,rename and delete a file is below. ``` try{ //To move a file from one folder t ... Read More