-->
Skip to main content

Posts

Understanding public static void main in java

Understanding public static void main in java public static void main in java public static void main in java Let's split public static void main in java and understand it one by one. What is public static void main in java public :  public is an access modifier, which specifies from where and who can access this method. public makes the method available globally. public keyword is used before the main method to specify the starting execution point of the program and will be visible to JVM. Example : What will happen if we change public to private or protected or default with no access modifier below is the code snippet for all the three and its output public class JavaCodeGeekMainExample { private static void main(String[] args) { System.out.println("Hello World"); } } public class JavaCodeGeekMainExample { protected static void main(String[] args) { System.out.println("Hello World"); } } public class JavaCodeGeekMainExample { static ...

How to Convert String to Array in Java [2021]

How to Convert String to Array in Java [2021] In today's programming world, We generally need to Convert String to Array in Java, In this tutorial, we will cover how to convert String to Array in Java using two approaches. Using the Split method of String class. Using the  Pattern class compile method with regular expression.  Earlier we have covered different conversion like  Convert to String from Byte Array In Java ,  Convert String to Byte Array in Java  and  Convert Between Java Byte Array to Object In Java  which is also similar to our current requirement. Let's dive in for our current tutorial... How to Convert String to Array in Java  1. Using the Split method of String class. How to convert String to Array in Java Using Split method The split method is used to split the string around the regular expression passed. The split method will convert sampleString "Java Code Geek" to three separate Array Elements Java Code Geek. ...

How to Change Port Number In Tomcat in 2021

How to Change Port Number In Tomcat in 2021 Everyday now and then developers face one problem that port 8080 is already in use thus we have to change the port number of our server, Today we will see how to change port number in tomcat. In the earlier tutorial, we have covered how to add tomcat server in eclipse . How to Change Port Number in Tomcat 1. How to Change Port Number in Tomcat Go to the directory where you have downloaded your tomcat server  For example : C:\Abhishek\Abhishek\java\servers\apache-tomcat-9.0.37 Now go to the conf folder   Apache Tomcat Server Path Now you will see server.xml file under conf folder as shown below Apache Tomcat Server XML Now opens the server.xml file and search for  port="8080" in server.xml file which will take us to this line.  Apache Tomcat Server Connector Port Now change the tomcat default port from 8080 to 9000 or any port you want above 7070 which is unique. Now this  will be lik e  Apache Tomcat Server C...