Java 4
Java 4
===========================
In java uppercase letters will consider as different and lowercase letters will
consider as different that's why we consider Java is a case sensitive programming.
As java is a case sensitive we must and should follow naming conventions for
following things.
ex:
classes
interfaces
variables
methods
keywords
packages
constants
classes
---------
In java , a class must and should starts with uppercase letter and if it contains
multiple words then each inner word starts with initcap.
ex:
Predefined classes Userdefined classes
----------------- -------------------
System Test
File ExampleApp
FileWriter DemoApp
BufferedReader QualityThought
and etc. and etc
interfaces
-----------
In java, an interface name must and should starts with uppercase letter and if it
contains multiple words then each inner word starts with initcap.
ex:
predefined interfaces Userdefined interfaces
------------------- ---------------------
Serializable ITest
Enumeration IDemoApp
ListIterator IExampleApp
Runnable IQualityThought
and etc. and etc.
variables
---------
In java, a variable name must and should starts with lowercase letter and if it
contains multiple words then each inner word must starts with initcap.
ex:
predefined variables userdefined variables
------------------ --------------------
out empId
in studName
err deptNo
length salary
and etc. and etc.
methods
------
In java, a method name must and should starts with lowercase letter and if it
contains multiple words then each inner word must starts with initcap.
ex:
predefined methods userdefined methods
------------------- -----------------
getClass() getDetails()
setName() setInfo()
getPriority() calculateBillAmt()
hashCode() getEmployeeDetails()
toString() and etc.
and etc.
keywords
---------
In java, all keywords we need to declare under lowercase letters only.
ex:
predefined keywords
-------------------
if, else , switch, do , while, for , public , static and etc.
packages
--------
In java, all packages we need to write under lower case letters only.
ex:
predefined packages userdefined packages
------------------ ------------------
java.lang (default pkg) com.google.www
java.io com.ihub.www
java.time com.qt.www
java.util and etc.
java.util.stream
java.text
java.sql
javax.servlet
and etc.
constants
----------
In java , all constants we need to declare in uppercase letters only.
ex:
predefined constants userdefined constants
----------------- --------------------
MAX_PRIORITY LIMIT
MIN_PRIORITY IHUB_TALENT
MAX_VALUE and etc.
MIN_VALUE
and etc.
Interview Questions
====================
Q)What is package ?
Assignment
============
1) class : QualityThought
2) Interface : IQualityThought
3) Variable : qualityThought
4) Method : qualityThought()
5) package : com.qualitythought.www