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 17

How to save data in a Java program. a) use serialization if the programs that use the saved data are Java b) write a plain text file Steps to save an object through serialization. FileOutputStream filestream = new FileOutputStream(“mygame.ser”); this will create a file ObjectOutputStream os = new ObjectOutputStream(filestream); this lets you to create objects, […]

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 […]