I bought several courses and I searched for 100s of videos, ur the best...you can explain this in different languages, and can help many more people. Thank you so much Sir.
@@possiblesupport1029 bro i know but you can't jump into java without having knowledge about oops concept so it my advice to go for oops concept i.e c++ then come to java
public class First { public static void main(String[] args) { System.out.println("hello world"); } } In the starting of Java program, JVM calls the main() method Public: so that it is accessible outside of the class static: so that jvm can access the main method without creating object of main class void: no value will be get return from the main method String args[] : It is array of Strings, main method passes this arguments so that we can send any information public nhi rahega to compiler bolega main method not found static nhi rahega to bolega ki main method ko static banao static members class ke name se call ho jaate hai
Sir what you said is completely correct but when i use blue j For the program i can write class display { public static void main () { System.out.println("hello sir"); } } If i do not use string args [] in blue j the compiler will not show the error So my question is (Is there any problem if I do not use String args [ ]
In Java, objects are not always created inside the main method; they can be created in any method or constructor within a class. However, you might be referring to the common practice of creating objects inside the main method when demonstrating or testing a class. This is because the main method serves as the entry point for a Java program, and creating objects there allows you to easily showcase the functionality of your classes and methods. 🤗