Java Program Structure, Naming Conventions & Data Types

Day: 3 &4 Java Program Structure Naming Conventions and Data types. Journey with Frontlines EduTech (FLM) and Fayaz S Program Structure:-     Package  package Name;     import Package Name.ClassName;     public Class Name {         variables like int a = 10;                                int b = 20;       public static void main (String []args){ } methods (public static void sum(){}); } Naming convention:   class name:-  Test, Test class, TestClassRole12.      ClassName is always in Pascal case. Variables Names :-  testClass, testRole.       Variables name is always in camel case. Method Name:-          Same as the variables. It will be started always in camel case.     Ex:-  connectToDb(){               }    Ex:-  add(){            } Package Names:-     Package Names always in small letters        Like :-  com, com.test, com.demo Project Name:-     Project name is also used Pascal case    Same as the ClassName. Dataatypes In Java:-     There are two days types 1. Primitive Data types 2. Non-primitive Data types 1. Primitive Data types:- These primitive data types are categorised into four types a. Interger data type b. Float data type c. Character data type d. Boolean data type a. Interger data types:- The integer data types are four types byte - 1 byte (8bits) Short - 2 byte(16bits) int - 4 byte (32bits) long - 8byte(64bits) b. Float data type:- The float are two types float - 4bytes ------> precision of 7digits double - 8bytes ----> precision of 16digits c. Character data types:- The character data types is used only single valued character which represents in single quotes. Ex:- K, A, H, C d Boolean data types:- The data type which is represented in the form of TRUE or FALSE. and its are only in small letters. The Boolean size is only 1 bit. Non-primitive Data types:- Non-primitive Data types are 5types 1. String 2. Class 3. Interface 4. Array 5. Enum. #corejava #namingConventions #Datatypes #java #frontlinemedia

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories