Core Java with SCJP/ OCJP Notes By Durga Sir Language Fundamentals nd DURGASOFT, # ,2 Floor,HUDA M aitrivanam,Ameerpet, Hyderabad – . SCJP Notes by Durga Sir Durgasoft PDF – Ameerpet Materials. Posted by SmlCodes. SCJP Notes by Durga Sir Durgasoft PDF -Ameerpet Materials. Download. DurgaSoft SCJP Notes Part-I Download – is a famous faculty in Hyderabad. He teaches the core java for the beginners and also will.
|Published (Last):||28 May 2007|
|PDF File Size:||2.73 Mb|
|ePub File Size:||6.36 Mb|
|Price:||Free* [*Free Regsitration Required]|
Skip to main content.
Log In Sign Up. Identifiers o Rules to define java identifiers: Reserved words o Reserved words for data types: Array declaration, construction, initialization in a single line.
DurgaSoft OCJP(SCJP) Notes Part-II Download | JAVAbyNATARAJ
Array element assignments 9. A name in java program is called identifier. It may be class name, method name, variable name and label name.
Rules to define java identifiers: The only allowed characters in java identifiers are: If we are using any other character we will get materiak time error. There is no length limit for java identifiers but it is not recommended to take more than 15 lengths. We can’t use reserved words as identifiers. All predefined java class names and interface names we use as identifiers.
Which of the following are valid java identifiers? In java some identifiers are reserved to associate some functionality or meaning such type of reserved identifiers are called scj; words. Reserved words for data types: Create several problems in old languages and hence it is banned in java.
Use final instead of this. By mistake if we are using these keywords in our program we will get compile time error. This keyword introduced in 1. All reserved words in java contain only lowercase alphabet symbols.
New keywords in java are: In java we have only new keyword but not delete because destruction of useless objects is the responsibility of Garbage Collection. Which of the following list contains only java reserved words? None of the above valid Which of the following are valid java keywords? Every variable has a type, every expression has a type and all types are strictly define more over every assignment should be checked by the compiler by the type compatibility hence java language is considered as strongly typed programming language.
Java is pure object oriented programming or not? Java is not considered as pure object oriented programming language because several oops features like multiple inheritance, operator overloading are not supported by java moreover we are depending on primitive data types which are non objects.
The most rarely used data type in java is short.
DurgaSoft SCJP Notes Part-I Download
This is most commonly used data type in java. Whenever int is not enough to hold big values then we should go for long data type. To hold the no. Of characters present in a big file int may not enough hence the return type of length method is long. All the above data types byte, short, int and long can be used to durgaaoft whole numbers. If we want to represent real numbers then we should go for floating point data types.
Floating Point Data types: Float double If we want to 5 to 6 decimal places of If we want to 14 to 15 decimal places of accuracy then we should go for float.
Part-1 (DurgaSoft SCJP notes) www.JavaEra.com
Not applicable virtual machine dependent Range: Not applicable but allowed values are true or false. Which of the following boolean declarations are valid? In java we are allowed to use any worldwide alphabets character and java is Unicode based and no. Any constant value which can be assigned to the variable is called literal. For the integral data types byte, short, int and long we can specify literal value in the following ways.
Allowed digits are 0 to 9. Allowed digits are 0 to 7.
Literal value should be prefixed with zero. Which of the following are valid declarations? But whenever we are assigning integral literal to the byte variables and its value within the range of byte compiler automatically treats as byte literal. Similarly short literal also. Floating point literal is by default double type but we can specify explicitly as float type by suffixing with f or F. The only allowed values for the boolean type are true or false where case is important.
We can specify that integral literal either in decimal or octal or hexadecimal form durvasoft allowed values range is 0 to Every escape character in java acts as a char literal. Any sequence of characters with in double quotes is treated as String literal. The following 2 are enhansements 1.
For the integral data types untill 1. The allowed digits are 0 to 1. Literal value should be prefixed with Ob or OB. Introduction An array is an indexed collection of fixed number of homogeneous data elements. The main advantage of arrays is we can represent multiple values with the same name so that readability of the code will be improved.
But the main disadvantage of arrays is: Fixed in size that is once we created an array there is no chance of increasing or decreasing the size based on our requirement that djrgasoft to mateiral arrays concept compulsory we should know the size in advance which may not possible always. We can resolve this problem by using collections. Single dimensional array declaration: If we want to specify the dimension before the variable that rule is applicable only for the 1st variable.
Second variable onwards we can’t apply in eurgasoft same declaration. Every array in java is an object hence we can create by using new operator. For every array type corresponding classes are available but these classes are part of java language and not available to the programmer level. At the time of array creation compulsory we should specify the size otherwise we materil get compile time error.
It is legal to have an array with size zero in java. If we are taking array size with -ve int value then we will get runtime exception saying NegativeArraySizeException. The allowed data types to specify array size are byte, short, char, int. By mistake if we are using any other type we will get compile time error. The maximum allowed array size in java is maximum value of int size . Multi dimensional array creation: In java multidimensional arrays are implemented as array of arrays approach but not matrix form.
The main advantage of this approach is to improve memory utilization. Which of the following declarations are valid? Whenever we acjp trying to print any object reference internally toString method will be executed which is implemented by default to return the following. If we are not satisfied with those default values then we can replays with our customized values.
Declaration, construction and initialization of an array in a single line: We can perform declaration, construction and initialization of an array in a single line. It is the final variable applicable only for arrays.
It represents the size of the array. It is a final method applicable for String objects. It returns the no of characters present in the String. There is no direct way to find total size of multi dimentional array but indirectly we can find as follows x[o].
In the case of primitive array as array element any type is allowed which can be promoted to declared type. For the int type arrays the allowed array element types are byte, short, char, int. For mateiral type arrays the allowed element types are byte, short, char, int, long, float. In the case of Object type arrays as array elements we can provide either declared type objects or its child class objects. In the case of interface type arrays as array elements we can provide its implemented class objects.
A char value can be promoted to int type but char array cannot be promoted to int array. In the case of object type arrays child type array can be assign to parent type array variable. Whenever we are assigning one array to another array internal elements won’t be copy materiaal reference variables will be reassigned hence sizes are not important but types must be matched.
Whenever we are assigning one array to another array dimensions must be matched that is in the place of one dimensional array we should provide the same type only otherwise we will get compile time error. Whenever we are performing array assignments the types and dimensions must be matched but sizes are not important. Total how many objects created?