Tuesday, November 27, 2012

About Presentation

We did our first individual presentation on 23rd of November 2012 in our separate practical room.We are only 13 students studying in Computer Science,and only 12 students did our presentation.One is missed who is Mugunthan.

Earlier planned 21st is presentation.But it was postponed to 23rd.

I told every students that i'll do first.

 23rd, we are preparing our self that time our lecturer Mr.K.Sarweswaran came.i did the presentation first,which about Big Data.i prepared myself and i discussed with our instructor about big data.So i understood big data.Then i decided to do first.
so i start the presentation in front of 10 students (kethees not come yet) and lecturer.that time i was very tension and i don't know what i'm presenting and i present what i know.
It's a 20 minutes presentation,after 15 minutes i'm totally out of mind.i don't know what i want to present and i forgot all the last 2 slides subject.Then i finished my presentation.but i didn't satisfied my performance.Then i   understand,that the only way to improve our talents with these types of presentation.So we want more sir.

Then Rajjazz presents his presentation about Intellectual Property rights.He did well.At that time kethees appeared in class.

Then Sutha did his presentation about Cloud Computing.Hi did also well and i know about cloud computing before.so i understand.but he tension in Question Answer time.

Then Sanjeewa did well.
Then Nazir Ali did well.Because he got a difficult heading Quantum Computing and he did well and he searched more things and give it us to understand.Well done nazir.Middle of his presentation our General students are come.
Then Ann give a presentation about Robotics ,and she did also well,and i understand about robotics and some other things.
Then Vive present about AR and Google Glass.It is also a new technology i never known before.well done vive.
Then Kalyani present about IPV6 and Ishara about Online Gaming and Thiva about vision Syndrome and jana about some bio subject that they all are done well.

so one is missing ,who is kethees.
Then he start his presentation about Social Media and He did well and i like his presentation and his presenting style..well done kethees.

The all presentations are finished at 3.45 p.m.
We all are got most points in this presentation,that about some basic skills about How to present a presentation.

Thank you sir to give this valuable opportunity.




Wednesday, November 7, 2012

why we use try and catch in java


Although the default exception handler provided by the Java run-time system is useful for debugging, you will usually want to handle an exception yourself. Doing so provides two benefits. First, it allows you to fix the error. Second, it prevents the program from automatically terminating. Most users would be confused (to say the least) if your program stopped running and printed a stack trace whenever an error occurred! Fortunately, it is quite easy to prevent this.
To guard against and handle a run-time error, simply enclose the code that you want to monitor inside atry block. Immediately following the try block, include a catch clause that specifies the exception type that you wish to catch. To illustrate how easily this can be done, the following program includes a tryblock and a catch clause which processes the ArithmeticException generated by the division-by-zero error:
class Exc2 { 
public static void main(String args[]) { 
int d, a; 
try { // monitor a block of code. 
d = 0; 
a = 42 / d; 
System.out.println("This will not be printed."); 
} catch (ArithmeticException e) { // catch divide-by-zero 
error 
System.out.println("Division by zero."); 

System.out.println("After catch statement."); 

}
This program generates the following output:
Division by zero. 
After catch statement.
Notice that the call to println( ) inside the try block is never executed. Once an exception is thrown, program control transfers out of the try block into the catch block. Put differently, catch is not "called," so execution never "returns" to the try block from a catch. Thus, the line "This will not be printed." is not displayed. Once the catch statement has executed, program control continues with the next line in the program following the entire try/catch mechanism.
try and its catch statement form a unit. The scope of the catch clause is restricted to those statements specified by the immediately preceding try statement. A catch statement cannot catch an exception thrown by another try statement (except in the case of nested try statements, described shortly). The statements that are protected by try must be surrounded by curly braces. (That is, they must be within a block.) You cannot use try on a single statement.
The goal of most well-constructed catch clauses should be to resolve the exceptional condition and then continue on as if the error had never happened. For example, in the next program each iteration of the for loop obtains two random integers. Those two integers are divided by each other, and the result is used to divide the value 12345. The final result is put into a. If either division operation causes a divide-by-zero error, it is caught, the value of is set to zero, and the program continues.
// Handle an exception and move on. 
import java.util.Random; 
class HandleError { 
public static void main(String args[]) { 
int a=0, b=0, c=0; 
Random r = new Random(); 
for(int i=0; i<32000; i++) { 
try { 
b = r.nextInt(); 
c = r.nextInt(); 
a = 12345 / (b/c); 
} catch (ArithmeticException e) { 
System.out.println("Division by zero."); 
a = 0; // set a to zero and continue 

System.out.println("a: " + a); 


}

How to Read from an Input File in Java

If you are coding in JAVA and you need to get input from a text file there are many ways you can choose to accomplish this. File reading objects such as Scanner, BufferedReader, and FileReader are commonly used in java. This article will focus on using the Scanner class in reading files in java.
Suppose you have a text file which contains a long list of integers that you need to read, do some calculations with, and out put the answer to the screen then you will need to know how to read the integers from a text file. The Scanner class is located in the java.util package. So make sure to add the following line in the beginning of your code so that you can use Scanner.
import java.util.Scanner;
You can import the entire util package by adding this line:
import java.util.*:
This will come in handy in case you are using another object in the package.
When reading from a file in your java code, you will have to make sure to throw the IOException in case there is a problem with your input file. If you do not do this, your java code will probably not compile. Make sure your main class declaration looks like this:
public static void main(String[] args) throws IOException{
}
You will also have to import the following for the exception.
import java.io.*;
Now, you are all ready to use the Scanner class. We now have to create a scanner object to use. If you are reading from a file, then you will have to declare the file inside of the Scanner parameters. In the following :
Scanner in = new Scanner(new File("myFile.txt"));
We have created a Scanner object named 'in' which will scan the File myFile.txt. This location is relative, so it will look for a file myFile.txt within the directory of the .class file. If your input file is not in the same directory, then you will have to write the entire file name inside of the quotation marks (make sure to use the correct form for \'s as you will have to use the escape character \\ , i.e. C:\documents\myFile.txt would become C:\\documents\\myFile.txt)
Now you can read from the file using several different methods such as nextInt() or nextLine(). (Check the link at the bottom for more methods in the Scanner class). To retrieve an integer from your file, you will use the .nextInt() to retrieve the integer, making sure to store it somewhere for use.
Here is a short snippet of code that will take every integer from a file and put it into an ArrayList.
Scanner in = new Scanner(new File("integers.txt"));
ArrayList intList = new ArrayList();
while(in.hastNextInt()){
intList.add(in.nextInt());
}
You can also read Strings, Doubles, and other types of objects, just make sure to use the correct format for the input or you will result with a run-time error.
Check out http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html to learn about the other methods of the Scanner class.