www.pickatutorial.com Computer Tutorials
Top eBooks: C/C++ | C# | Android | Mathematics | Database | Cloud | Graphics | Networking | Oracle | Hardware | AI
Top Tutorials: C/C++ | C#.NET | PHP MySQL | Java | Java Script | jQuery | HTML | xHTML | HTML5 | VB Script| CSS
Lessons Useful Java Classes Bookmark and Share
Tutorial Home
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
Lesson 8
Lesson 9
Lesson 10
Lesson 11
Lesson 12
Lesson 13
Lesson 14
Lesson 15
Lesson 16
Lesson 17
Lesson 18
Lesson 19
Lesson 20
Lesson 21
Lesson 22
In this lesson we will learn about some basic Java classes that are really useful . These useful classes are provided in the java.lang package.

The first one is the Object class. The Object class is the base class of all the java classes. All Java classes are implicitly derived from the Object class. The Object class provides a number of useful methods like toString() etc. As all classes in Java are implicitly derived from the Object class, all the methods defined in the Object class are automatically available in every Java class.

The second useful Java class is the String class. Like in C++ the String class in Java is used to manipulate text.

String Creation:
String S1 = "hello", // initialize from a string literal
S2 = new String("bye"), // use new and the String constructor
S3 = new String(S1); // use new and a different constructor

String concatenation
String S1 = “hello” + “world”;
String S2 = S1 + “!”;
String S3 = S1 + 10;

The java.lang.String class has many useful methods. If you are interested, just explore the Srtring class in the Java documentation.

Java SDK also provides classes for primitive types. These include: Boolean, Integer, Double, Float etc. Note that variables of type bool, int, double, float etc. are not objects whereas variable of type Boolean, Integer, Double, Float etc. are objects.
Next >>> Lesson No. 15: Java Classes vs C++ Classes

Home - Advertise - Contact - Disclaimer - About Us
© Since 2006 pickatutorial.com -- All Rights Reserved.