Skip to main content

Variable , Constant , Comments in JAVA ?


java

Variable

-A variable can be define as a memory location that stores an data value of a certain type.
-A variable consists of a data type along with a suitable name.
-Assigning a value for a variable for the first time is called initializing a variable.
example int age;




output



first we took integer the declare its value and then print the output.

Constant

-The difference between a constant and a variable is that the value held by a variable can be changed throughout the problem execution . but after a constant has been initialized we can not change the value in it.
example final double pi 21/7  




output



ERROR , because we have already declared the value of PI.


Comments

-Comment can be used to explain written code.
-This will help a person to read and understand the code in future . 
-Comments are ignored by the compiler during compilation.



Whatever is written inside the comments will not be printed because it is only for understanding.

Comments

Post a Comment

Popular posts from this blog

What is Data abstraction? explain in detail ?

  What is Data abstraction? explain in detail ?  hey everyone today we will talk about what is data abstraction. Data abstraction data abstraction refers to the process of hiding irrelevant details from the user. The need of efficiency has led designed from the complex data structure to represent data in the database. here the three levels of data abstraction- 1.view level : The highest level of abstraction describe only part of the entire database. Even thought the logical level of user simple structure , complexity remains because of the variety of information stored in a large Database system do not need all this information inserts they need to access only a  part of the Database .The view level of abstraction exists to simplify their interaction with the system . The system may provide many view for the same Database.                                      2. logical level: ...

Define DBMS ? And it's applications .

  Define DBMS ? And it's applications || 2inshort Hey everyone , today we will talk about Database  management system ,this subject is very important in engineering. Define DBMS :   Data base is a collection of related data in a systematic manner. It is a system of storing and taking care of data , data can be easily accessed managed and updated. Data base can have multiple tables.Database is controlled through a software called DBMS. SO what is DBMS? -DBMS is a computer software application. -DBMS interact with user , other application and Database itself to retire and analysis the data. -accept request for data from an application and instructs OS and provide specific data. -DBMS allows users  to create their own data. example - Oracle , Microsoft , SQL ,  MySQL ,  DB2 , ORION , IMS  , Foxpro , MongoDB Applications of DBMS 1. Banking ( All transactions) :  We make thousands of transactions through banks daily and we can do this without going to ...

What Is JAVA ? Data types in java

  JAVA Designed by - james gosling released  - 1995   A java is a programming language . it is one of the most popular programming language in the world . created by james gosling at sun Microsystems. First it was named Oak then Green and finally java. currently the ownership of the programming language is with Oracle. uses of java ? create Desktop applications . create mobile application .  create web application .  create games. used in web and application servers. why learn java ? It is a fast and powerFull language . It works on many platforms like window , mac , Linux etc. Easy to learn and use .open source and free. Learning other languages will be way more easier after learning java and its OOP concept. java first program *Every java program is written inside a class. *Commands start to execute from the main method in the class. 1. save the file using the same name used for the class name with extension .java. 2. Compile (This will create the java byte co...