Garbage Bag

All my Garbage talks and junk codes

Month: July, 2010

நண்பனின் காய்ச்சலிலே …

உடல்நலமற்ற தோழன்
உச்சக்களிப்பில் நான்

ஓய்வின்றி நடமாடிய நீ
இன்று நோய்வுற்று மடி சாய்ந்ததால் !

தாலாட்ட இங்கு தாய் இல்லை – இருந்தும்
கவலை உன் கண்ணில் துளி இல்லை
இன்னும் உயிரோடு நான் இருப்பதாலோ !

உயிருள்ளவரை என்னை நினைப்பாயோ !
குணமானபின் நொடியில் மறப்பாயோ !

எதிர்பார்ப்புகள் இன்றி சேவை செய்கிறேன்
என்றென்றும் காத்து கிடக்கிறேன்
மறுமுறை மடிசாயும் தருணத்தை ஏங்கி !

- கார்த்திக் செல்வகுமார்

Session On Java Basics

i) Is java purely object oriented language ?

JAVA is not because it supports Primitive datatype such as int, byte, long… etc, to be used, which are not objects.

ii) Write once run anywhere concept ?

Java source code is compiled into class file . This file is executed on any platform which has JVM

iii)  public static void main(String args[])

java environment needs acces to execute it –> public

without creating instance need to run main method   –> static

main method doesnt return anything — > void

all arguments passed are of string type and placed in a string array  –> args[]

iv) diff between == and .equals()

== compare reference

.equals compares the content

v) Access specifier a quick play

public , private protected , default

vi) final , finally and finalize

final – to declare constants and avoid inheriting a class

finally – in exception handling to run a piece of code even exception occurs or not

finalize – whenever garbage collection is about to occur finalize method will be called

vii) java API swing , applets , servlets

viii) no global variable in java ?

referential transparency

namespace collision

ix) Numeric promotion

after any arithmetic operation  (byte,char,short)–>int–> long–>double

x) first argument of args[] in C and java

in C first argument will be the name of the program but in java it is the first argument passed

xi) library methods stringtokenizer

StringTokenizer st=new StringTokenizer(“karthik:be:cse”,”:”,false);

while(st.hasMoreElements(){

print(st.nextToken()); {

points about java :

* No pointers -  Unauthorized access prevention

* No operator overloading - ambiguity is possible

* No destructor – instead finally is present

* Multithreading made thro language – concurency

* new to allocate memory to object … memory release done by garbage collector

Follow

Get every new post delivered to your Inbox.