Java Program To Create Methods
01. Example: class createMethods { // Constructor method createMethods() { System.out.println("Constructor Method: It is called when an object of it's class is created. "); } // Main method where program …
01. Example: class createMethods { // Constructor method createMethods() { System.out.println("Constructor Method: It is called when an object of it's class is created. "); } // Main method where program …
01. Example: public class stringLowerCaseConvesion { public static void main(String args[]) { String string01 = "Learn Java With Zeroones"; String stringLowerCase = string01.toLowerCase(); System.out.println(stringLowerCase); } } Output: learn java with …
01. Example: public class splitStringSpace { public static void main(String args[]) { String string01 = "Learn Java With Zeroones"; String[] elements = string01.split("\s"); for (String element: elements) { System.out.println(element); } …
01. Example: public class StringTrimExample { public static void main(String args[]) { String string01 = " Learn Java With Zero "; System.out.println(string01 + "ones"); System.out.println(string01.trim() + "ones"); } } Output: …
01. Example: public class replaceStringWithNewString { public static void main(String args[]) { String string01 = "Learn Java With Zeroones"; System.out.println("Old String:"); System.out.println(string01); System.out.println("nNew String:"); String newString = string01.replaceAll("Java", "Java And …
01. Example: public class indexOfFunction { public static void main(String args[]) { String string01 = "Learn Java With Zeroones"; int index1 = string01.indexOf("With"); System.out.println("Start Index Of 'With': " + index1); …
01. Example: class stringEndWith { public static void main(String args[]) { String string01 = "Learn Java With Zeroones"; System.out.println(string01.endsWith("s")); System.out.println(string01.endsWith("oones")); System.out.println(string01.endsWith("one")); } } Output: true true false
01. Example: public class stringComparison { public static void main(String args[]) { String string01 = "zeroones"; String string02 = "Zeroones"; String string03 = "zero one"; String string04 = "zeroones"; System.out.println(string01.compareTo(string02)); …
01. Example: import java.util.Scanner; class transposeOfMatrix { public static void main(String args[]) { int m, n, c, d; Scanner input = new Scanner(System.in); System.out.print("Enter The Matrix Number Of Rows And …
01. Example: import java.util.Scanner; class multiplicationOfMatrices { public static void main(String args[]) { int m, n, p, q, sum = 0, c, d, k; Scanner input = new Scanner(System.in); System.out.print("Enter …