Wednesday, December 17, 2008

Object oriented programming 1 in java: objects and methods

I/ Declare variables and initialize string objects

1. String s1;// String is a class
2. String s1 = new String(); // create an empty string s1
3. String s1 = "Whatever"; // every string is an object
4. String s2 = s1; // s2 references to a box (object) that has a content of "Whatever"
5. String s2 = new String(s1);

II/ Methods

1. String s3= s1.Uppercase() // s3 references to a box that has a content of "WHATEVER"

No comments:

Post a Comment

Mounting USB drives in Windows Subsystem for Linux

Windows Subsystem for Linux can use (mount): SD card USB drives CD drives (CDFS) Network drives UNC paths Local storage / drives Drives form...