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

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

Reading and writng objects to a file using nio in java

reading writing objects nio java

* Here we will be using read and write files using java.nio package which came available in java 1.4 ... Read More

Encapsulation

encapsulation java

Encapsualtion is used to make class members non-accesible outside the class. We can make some cl ... 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

Logical operators in regular expressions in java

Logical operators regular expressions java

We have already seen the Or operator in previous post ``` System.out.println("Harry".replace ... Read More

Interfaces in java

interfaces java

* They are purely abstract classes.So no function can have defination in an interface.Interfaces con ... Read More

Creating files and directories in java

Creating files and directories java

Code to create files ,directories and to create multiple files is below ``` try { ... 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