Syntax of JAVA program


Hello learners, today we start the
structure of most popular high level language that is Java, after discussing the structure of C and C++ languages. Let us start with the Structure of Java Program: Structure of a Java program is standard format released by language developers to the programmer. As we know Java was developed by Sun Microsystems. Sun Microsystems has prescribed structure for the Java programmers for
developing java application. First of all, according to the structure java program starts with a package. If we think about a word package generally we consider a container. As we know, Java is an inbuilt language so it contains everything in itself. User needs to use only these inbuilt features. So, a package is a collection of classes, interfaces and sub packages. For example : Java language
asterisks is a package imported by default and this package is known as
default package. Next is Class: As discussed earlier Java is purely object-oriented language, so it walks in the classes. Every program starts with a consecutive
class. Class is keyword use for developing user-defined data type. It means user can define the data types of his or her own choice. Then Class Name: As writing the keyboard class next step is to decide a class name. Class name represent a Java Willet variable named treated as a name of the class. Each and every class name in Java is treated as user-defined data type. When we save the Java program that name also should be same as the class name. If it will not be so then there will be an error at the time of execution. After defining class name, next step is Data Member: Data members are basically variables. They represent either instance or static. They will be selected based on the name
of the class. Further is, User-defined Methods: User-defined methods represents either instance or static that are meant for performing the operations are the
ones or each and every time. Then Main Functions: Each and every Java program starts execution from the main method and hence main method is known as program driver. Since main method of Java is not returning any value and hence its
return type must be void. The main method of Java execute only once throughout the Java program execution and hence its nature must be static. Main method must be assessed by every Java programmer and hence whose assess specified must be public. Each and every main method of Java must take array of objects of string. Next we have a Block of Statements: Similar to C and C++ Java also have a block of statements represent sets of executable statements which are in turn calling user-defined methods are containing business logic. The file naming conversion in the java programming is that whichever classes
containing main method that class name must be given as a file name with an
extension java. It is all about syntax of Java Program. In next video we’ll take example of Java program. Thank You

Leave a Reply

Your email address will not be published. Required fields are marked *