Your SlideShare is downloading. ×
Java2 eg
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Java2 eg

390
views

Published on


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
390
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Java program is actually a collection of files distributed in a forest of tree-structured directory hierarchy. The roots are accessible thro CLASSPATH, and the directory names are package names. The file names correspond to PUBLIC classes. Java system uses this mapping to fetch classes from the file system.
  • PUBLIC by default. A class implementing this interface must explicitly declare methods as PUBLIC because the default is PACKAGE. ( cut-and-paste of headers will not work!)
  • Need Wrapper class Integer to convert primitive value of int type to a reference type value. Implementing means adding data structure and defining methods in terms of primitive operations on the data structures. Both key and value must be non- null .
  • Framework-oriented Programming
  • Array object contains size info, array type does not. Cf. Array bounds can be checked at run-time. Empty array : new int[0][0];
  • intArray -> 0 2 4 6 8
  • argv = args argc = args.length Complete Java Application
  • Length field: objects carry type tags array objects carry bound information index : 0.. Length - 1 23 args “ c” “ a” “ abc”
  • In Java, strings are treated as objects that can be manipulated using well-defined operations on strings. In C++, strings are basically a sequence of characters followed by a null-character. One can perform low-level operations based on the implementation detail that can effect/change the string-view. For instance, consider a string variable char * str containing a pointer to the sequence of bytes abcde Now one can assign to position 2 and obtain a string ab. So, replacement of a charater actually manifests itself as deletion of suffix.
  • “ +”(addition) is associative wrt Integers and Reals. “ +” (concatenation) is associative wrt strings. However, when we combine the two in an expression ordering becomes important because of how the overloading is resolved. Concatenation freshly allocates a string and initializes it by copying the contents of the operand strings.
  • All constant string expressions are evaluated at compile-time, and equivalent expressions are mapped to the same string object. Explicit invocation of “intern()” accomplishes the same task at run-rime.
  • In dynamic typing, the operations perform type checking followed by traditional expression evaluation.
  • Except for the case of an expression containing a type cast, static typing is supposed to guarantee that a method call on a (polymorphic) variable will succeed by ensuring existence of the method for all objects that the variable can hold reference to.