String API provides 2 methods to split String in java.
1 2 |
public String[] split(String regex) public String[] split(String regex,int limit) |
String API provides 2 methods to split String in java.
1 2 |
public String[] split(String regex) public String[] split(String regex,int limit) |
In Java we have multiple ways to convert String to long. We will see a few of those ways in this post. 1. Convert String to long using Long.parseLong()
1 2 |
String str1 = "500"; long convertedLong = Long.parseLong(str1); |
In this post we will see how to convert String to date in java. For this we will use SimpleDateFormat API to convert string to date. We need to pass in the dateformat in which we want to convert St
We can compare Strings in java either using == or equals() depending on how the String was created. Using == to compare Strings in java ==
In Java we have multiple ways to convert String to boolean. We will see a few of those ways in this post. 1. Convert String to boolean using Boolean.parseBoolean() For Any value of string other tha
In Java we have multiple ways to convert String to int. We will see a few of those ways in this post. 1. Convert String to int using Integer.parseInt()
1 2 |
String str1 = "500"; int convertedInt = Integer.parseInt(str1); |
How to Create a String As we know that String in java can be created using 2 types. 1. Direct initialization String textString = "This is test"; 2. Using a new operator [crayon-64833c58ad82a51293822
Spring MVC password tag is used to show a password field on the UI
1 |
<form:password path="password" /> |
1 |
<input id="password" name="password" type="password" value=""> |
We can create dir in java either using File.mkdir() or File.mkdirs(). Example: Create Dir in java using File.mkdir()
1 2 3 4 5 6 7 8 9 10 11 12 |
public static void createDir() { File directory = new File("C:\\kscodes"); boolean dirCreated = directory.mkdir(); if (dirCreated) { System.out.println("Directory Created Successfully !!!"); } else { System.out.println("Unable to create Directory"); } } |
There are many ways in which you can copy file in java. Example : Copy File in java using InputStream/OutStream In the first example we will see the traditional way of copying file using the InputS