Java Language Fundamentals
Identifiers
- A name in a program is called an identifier.
- Identifiers can be used to denote classes, methods, variables, and labels.
- In Java an identifier is composed of a sequence of characters, where each character can be either a letter, a digit, a connecting punctuation (such as underscore _), or any currency symbol (such as $, ¢, ¥, or £). However, the first character in an identifier cannot be a digit.
- Identifiers in Java are case sensitive, for example, price and Price are two different identifiers.
Examples of Legal Identifiers: number, Number, sum_$, bingo, $$_100, mål, grüß
Examples of Illegal Identifiers: 48chevy, all@hands, grand-sum
Keywords
- Keywords are reserved identifiers that are predefined in the language and cannot be used to denote other entities.
- All the keywords are in lowercase, and incorrect usage results in compilation errors.
Literals
- A literal denotes a constant value, that is, the value a literal represents remains unchanged in the program. Identifiers can be used to denote classes, methods, variables, and labels.
- Literals represent numerical (integer or floating-point), character, boolean or string values. In addition, there is the literal null that represents the null reference.
Examples of literals
- Integer 2000, 0, -7
- Floating-point 3.14, -3.14, .5, 0.5
- Character 'a‘, 'A‘, '0‘, ':‘, '-‘, ')'
- Boolean true, false
- String "abba“, "3.14“, "for“, "a piece of the action“
Comments
A program can be documented by inserting comments at relevant places. These comments are for documentation purposes and are ignored by the compiler.
Java provides three types of comments to document a program:
- A single-line comment: // ... to the end of the line
- A multiple-line comment: /* ... */
- A documentation (Javadoc) comment: /** ... */
Primitive data types
Primitive data types in Java can be divided into three main categories:
- Integral types— represent signed integers (byte, short, int, long) and unsigned character values (char)
- Floating-point types (float, double)— represent fractional signed numbers
- Boolean type (boolean)— represent logical values
Primitive data values are not objects. Each primitive data type defines the range of values in the data type, and operations on these values are defined by special operators in the language.
Variable declaration
A variable stores a value of a particular type. A variable has a name, a type, and a value associated with it. In Java, variables can only store values of primitive data types and references to objects. Variables that store references to objects are called reference variables.
Declaring and Initializing Variables
Variable declarations are used to specify the type and the name of variables. This implicitly determines their memory allocation and the values that can be stored in them.
- char a, b, c; // a, b and c are character variables.
- double area; // area is a floating-point variable.
- boolean flag; // flag is a boolean variable.
A declaration can also include initialization code to specify an appropriate initial value for the variable:
- int i = 10; // i is an int variable with initial value 10.
- long big = 2147483648L; // big is a long variable with specified initial value.
Object Reference Variables, An object reference is a value that denotes an object in Java. Such reference values can be stored in variables and used to manipulate the object denoted by the reference value. Before we can use a reference variable to manipulate an object, it must be declared and initialized with the reference value of the object.
- Pizza yummyPizza; // Variable yummyPizza can reference objects of class Pizza.
- Hamburger bigOne; // Variable bigOne can reference objects of class Hamburger
- Pizza yummyPizza = new Pizza("Hot&Spicy"); // Declaration with initializer.
It’s always so sweet and also full of a lot of fun for me personally and my office colleagues to search your blog a minimum of thrice in a week to see the new guidance you have got.
ReplyDeleteBest Java Training Institute Chennai
Those rules moreover attempted to wind up a decent method to perceive that other individuals online have the indistinguishable enthusiasm like mine to get a handle on incredible arrangement more around this condition. dotnet training in bangalore
ReplyDeleteDotnet developer
Great content thanks for sharing this informative blog which provided me technical information keep posting.
ReplyDeleteHadoop Training in Chennai
Hadoop Training in Bangalore
Big data training in tambaram
Big data training in Sholinganallur
Big data training in annanagar
ReplyDeleteGreat post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
rpa training in Chennai
rpa training in anna nagar | rpa training in marathahalli
rpa training in btm | rpa training in kalyan nagar
rpa training in electronic city | rpa training in chennai
rpa online training | selenium training in training
Have you been thinking about the power sources and the tiles whom use blocks I wanted to thank you for this great read!! I definitely enjoyed every little bit of it and I have you bookmarked to check out the new stuff you post
ReplyDeletePython training in marathahalli
Python training in pune
AWS Training in chennai
Well you use a hard way for publishing, you could find much easier one!
ReplyDeleteData science training in tambaram | Data Science training in anna nagar
Data Science training in chennai | Data science training in Bangalore
Data Science training in marathahalli | Data Science training in btm
I believe we could greatly benefit from each other. If you happen to be interested, feel free to shoot me an e-mail. I look forward to hearing from you! Great blog by the way!
ReplyDeletefire and safety course in chennai
Good Thought!
ReplyDeleteJava Training in Chennai
Python Training in Chennai
IOT Training in Chennai
Selenium Training in Chennai
Data Science Training in Chennai
FSD Training in Chennai
MEAN Stack Training in Chennai
such an great post and amazing tips about semrush because i like it and thank you. keep it up.
ReplyDeleteFor Premium Accounts at cheap rate check this site premium Accounts Seller
Netflix premium account -- Netflix premium Account
Premium Accounts at cheap -- Hotstar premium Account
Hotstar premium account -- Hotstar premium Account
https://www.vox.com/users/MrTechnoMind
ReplyDeleteI wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post.is article. Thanks for sharing
ReplyDeleteMicrosoft Windows Azure Training | Online Course | Certification in chennai | Microsoft Windows Azure Training | Online Course | Certification in bangalore | Microsoft Windows Azure Training | Online Course | Certification in hyderabad | Microsoft Windows Azure Training | Online Course | Certification in pune
Annabelle loves to write and has been doing so for many years.iamlinkfeeder5 iamlinkfeeder5 iamlinkfeeder5 iamlinkfeeder5 iamlinkfeeder5 iamlinkfeeder5 iamlinkfeeder5 iamlinkfeeder5 iamlinkfeeder5
ReplyDeleteAnnabelle loves to write and has been doing so for many years.iamlinkfeeder3 iamlinkfeeder3 iamlinkfeeder3 iamlinkfeeder3 iamlinkfeeder3 iamlinkfeeder3 iamlinkfeeder3 iamlinkfeeder3 iamlinkfeeder3
ReplyDeleteAnnabelle loves to write and has been doing so for many years.Backlink Indexer My GPL Store Teckum-All about Knowledge
ReplyDeleteAnnabelle loves to write and has been doing so for many years.linkfeeder3 linkfeeder3 linkfeeder3 linkfeeder3 linkfeeder3 linkfeeder3 linkfeeder3 linkfeeder3 linkfeeder3
ReplyDeleteAnnabelle loves to write and has been doing so for many years.linkfeeder2 linkfeeder2 linkfeeder2 linkfeeder2 linkfeeder2 linkfeeder2 linkfeeder2 linkfeeder2 linkfeeder2
ReplyDeleteTheodore Hall (Ted) is a retired manufacturing executive who has gotten into Internet Marketing कल्याण मटका रिजल्ट Kalyan matka Satta Result
ReplyDeleteAnnabelle loves to write and has been doing so for many years.buyseoservice3 buyseoservice3 buyseoservice3 buyseoservice3 buyseoservice3 buyseoservice3 buyseoservice3 buyseoservice3 buyseoservice3
ReplyDeleteAnnabelle loves to write and has been doing so for many years.BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE
ReplyDeleteAnnabelle loves to write and has been doing so for many years.meri recipe indnewstv fullinhindi buy seo service
ReplyDeleteAnnabelle loves to write and has been doing so for many years.BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE
ReplyDeleteAnnabelle loves to write and has been doing so for many years.BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE BUY SEO SERVICE
ReplyDeleteBe a part of India's fast growing institution . As our institution is providing CS executive classes and free CSEET classes . So don't waste your valuable time and contact us or visit our website at https://uniqueacademyforcommerce.com/
ReplyDeleteThanks for sharing such a worthy information. Keep update like this.....
ReplyDeleteIELTS Coaching in Hyderabad
IELTS Coaching in Bangalore
Tired of sharing long, nasty URLs? This app immediately shortens URLsCRYPTO NEWS 24X7
ReplyDeleteThis post is so interactive and informative.keep update more information...
ReplyDeleteSalesforce Training in Tambaram
Salesforce Training in Chennai
It is extremely nice to see the greatest details presented in an easy and understanding manner.
ReplyDeletedata science institutes in hyderabad
Tired of sharing long, nasty URLs? This app immediately shortens URLsLinkfeeder3.0 Linkfeeder3.0 Linkfeeder3.0 Linkfeeder3.0 Linkfeeder3.0 Linkfeeder3.0 Linkfeeder3.0 Linkfeeder3.0 Linkfeeder3.0 Linkfeeder3.0
ReplyDeleteNICE POST AND THANKS FOR SHARING!!
ReplyDeleteGraphic Design Training in Hyderabad
Graphic Design Training in Delhi
Graphic Design Training in Gurgaon
kralbet
ReplyDeletebetpark
tipobet
slot siteleri
kibris bahis siteleri
poker siteleri
bonus veren siteler
mobil ödeme bahis
betmatik
FNFHO
Save day speech college usually. Side some price data certain daughter kind. Personal final move result step.insightminutes.com
ReplyDeleteCustomer various position recent development hit morning. Already message use level nor what ball bank.trending-updates
ReplyDelete