TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Sunday, 9 February 2020

Naming conventions in java for variables | file naming conventions

Naming Conventions in Java

   
Java uses CamelCase as a practice for writing names of methods, variables, classes, packages and constants.
Camel case in Java Programming : It consists of compound words or phrases such that each word or abbreviation begins with a capital letter or first word with a lowercase letter, rest all with capital.
 
 javascript file naming conventions ,
java naming convertion

     1.    Classes and Interfaces :

·         Class names should be nouns, in mixed case with the first letter of each internal word capitalised. Interfaces name should also be capitalised just like class names.
·         Use whole words and must avoid acronyms and abbreviations.

Examples:

interface Bicycle
class MountainBile implement Bicycle
interface Sport
class Football implement Sport

    2.    Methods :

·         Methods should be verbs, in mixed case with the first letter lowercase and with the first letter of each internal word capitalised.

Examples:

void changeGear(int new Value);
void speedup(int increment);
void applyBrakes(int decrement);


    3.    Variables : Variable names should be short yet meaningful.
·         Should not start with underscore(‘_’) or dollar sign ‘$’ characters.
·         Should be mnemonic i.e, designed to indicate to the casual observer the intent of its use.
·         One-character variable names should be avoided except for temporary variables.
·         Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters.

Examples:

//variable for MountainBike class
int  speed=0;
int  gear=1;

   4.    Constant variables:

·         Should be all uppercase with words separated by underscores (“_”).
·         There are various constants used in predefined classes like Float, Long, String etc.

Examples:

Static final int MIN_WIDTH=4;
//Some Constant variable used in predefined Float class
public static final float POSITIVE_INFINITY=1.0f/0.0f;
public static  final float NEGATIVE_INFINITY=1.0f/0.0f;
public static final float NaN =0.0f/0.0f;



    5.    Packages:

·         The prefix of a unique package name is always written in all-lowercase ASCII letters and should be one of the top-level domain names, like com, edu, gov, mil, net, org.
·         Subsequent components of the package name vary according to an organisation’s own internal naming conventions.

Example:

com.sum.eng
com.apple.quicktime.v2
//java.lang packet in JDK
Java.lang

No comments:

Post a Comment