Data Types – 2 types
- Variables must always declared with a name and a type.
- Class - First letter CAPS for each new word ex : SavingGoal
- Function(method) - First Letter SMALL ex : updateSavings()
- Variable - First Letter SMALL ex : Dog tommyHigh
- Packages - all SMALL letters ex :
- Constructors - First letter CAPS for each new word (like class) ex : SavingGoal
1.Primitive Variables
Ex : int x = 8 ;
Type Bit-Depth Value-Range Default value
boolean JVM specific true,false false
char 16 bits 0 to 65535
byte 8 bits -128 to 127
short 16 bits -32768 to 32767
int 32bits -2147483648 to 2147483647
long 64 bits -huge to huge
float 32 bits varies
double 64 bits varies
2.Reference Varibales
Ex : Dog myDog = new Dog();
The value of the variable is bits representing a way to get to a specific object
(.) Dot operatore is used to refer the value in reference variable.
It's default value is null when not referening any object.
Arrays - it is always an object.
ex: nums = new int[7];
Once you declared an array, you can't put anything in it except things that are of the declared array type.
However you can put a byte into an int array. it is implicit widening.
- Class - is a blueprint for an object.
- Description for JVM to make object is nothing but a class.
- Class consists instances (instance variables) and methods.
- Mark instance variables private
- Mark getters and setters public(get and set methods)
- Instance variables always gets default value.
- Local variables(variables in methods) do NOT get a default value.Compiler reports error for this.
- Use == to compare two primitives or two references ex : int a = 4; int b = 4; if (a == b) print x;
- USe the equals() method to see if two different objects are equal(such as two different String objects).
- Java uses pass by value - " pass by value is passing by copy".
Wednesday, October 08, 2008
//
Labels:
Java
//
1 comments
//
1 comments to "Java lessons learned - Naming Convention, Variables,Data Types, Arrays"
Post a Comment
Whoever writes Inappropriate/Vulgar comments to context, generally want to be anonymous …So I hope U r not the one like that?
For lazy logs, u can at least use Name/URL option which doesn’t even require any sign-in, The good thing is that it can accept your lovely nick name also and the URL is not mandatory too.
Thanks for your patience
~Krishna(I love "Transparency")
Popular Posts
-
The best solution to know about these init levels is to understand the " man init " command output on Unix. There are basically 8...
-
How to Unlock BSNL 3G data card to use it with Airtel and Vodafone Model no : LW272 ? How to unlock BSNL 3G data card( Model no : LW272 )us...
-
How to transfer bike registration from one State to other (Karnataka to Andhra)?? Most of us having two wheelers purchased and registered in...
-
ఓం శ్రీ స్వామియే శరణం ఆయ్యప్ప!! Related posts : Trip to Sabarimala - Part 1 Trip to Sabarimala - Part 2 Ayappa Deeksha required things...
-
Following are some of interesting blogs I found till now ...please comment to add your blog here. Blogs in English : http://nitawriter.word...
Popular posts
- Airtel and vodafone GPRS settings for pocket PC phones
- Andhra 2 America
- Ayyappa Deeksha required things
- Blogs I watch !
- Captions for your bike
- DB2 FAQs
- Deepavali Vs The Goddes of sleep
- ETV - Dhee D2 D3
- Evolution of smoking in India Women
- How to make credit card payments?
- init 0, init 1, init 2 ..
- Java-J2EE interview preparation
- mCheck Application jar or jad download
- My SQL FAQs
- My Travelogues
- Old is blod - New is italic
- Online pay methids for credit cards
- Oracle FAQs
- Pilgrimages
- Smoking in Indian Women
- Technology Vs Humans
- Twitter feeds for all Telugu stars on single page.
- Unix best practices
- Unix FAQs
Buffs ...
Tags
Powered by WidgetsForFree
Archives
-
▼
2008
(132)
-
▼
October
(15)
- Deepavali Vs Goddess of sleep
- Dream home designer software - Google SketchUp
- Old is Bold - New is Italic
- Solaris Commands - Tips - Installtion - All about ...
- Microsoft PowerToys for Windows XP
- Handy tools for Browser Testing (IE6, IE7, FF)
- BSNL Dial up Connectiion
- IE7 - runonce.msn.com/runonce3.aspx
- JRE - Browsers ( IE, Firefox)
- Trip to Kolar, Kotilingeshwara, Bangaru Tirupati, ...
- Java lessons learned - Naming Convention, Variable...
- Andhra to America
- BOTDA
- Is your blog listed under unauthorized Web pages w...
- Number of files in a directory
-
▼
October
(15)
Nataraj says:
In your post "Java Lessons Learned" under the section 'Naming conventions for JAVA units'
you were talking about First letter CAPS for each new word ex : SavingGoal.
This style is known as Camel Case.
For more http://en.wikipedia.org/wiki/CamelCase ;-)