JAVA Beginners part 18

Client and Server Model – how to establish connection to the server – how to send messages to the server – how to receive messages from the server Socket chatSocket = new Socket(“196.164.1.103”,5000); 196.164.1.103 address of the sever 5000 is the port number server / TCP port numbers ftp/20 telnet/23 smtp/25 time/37 https/443 pop3/110 http/80 […]

JAVA Beginners part 15

Java Sound ——— 1)get a sequencer sequencer player = midisystem.getsequencer(); 2)make a new sequence sequence seq = new sequence(timing,4); 3)get a new track track t = seq.createTrack(); 4)fill in the track with midievents t.add(mymidievent1); player.setsequence(seq); the actual instructions of a song is held in the message. setmessage(144,1,44,100) 144 says the message type, on or off […]

JAVA Beginners part 12

Java has two memory areas which are Heap and Stack ————————————————– Objects live in Heap ( Garbage collectible Heap) Variables and methods live in Stack Instance variables the variables declared in a class and are associated with an Object.They live on Heap. Local variables are the one declared in a method which include the method […]

JAVA Beginners part 6

Getters and Setters. These set the values for Instance variables and get the value of them when you ask for it. They are basically methods. Encapsulation One of the pillars of Object oriented language. One design approach, Make all the Instance variables private. Then make the Getters and Setters as public. So, In case you […]

JAVA Beginners part 5

Reference variable┬álike a pointer , it doesn’t hold the object but knows how to access the Object which is in Heap. example Dog mydog = new Dog(); Note: This reference variable is forever of type Dog. It is very important to think of above object creation in a 3 step process. Interesting thing about Reference […]