Posts

Programming Fundamentals Lab Manual 14

Programming Fundamentals Lab Manual 14 Statement Purpose: One of the secrets of the low latency is that each implementation can generate a custom built fix engine based exactly on the schema it requires. Activity Outcomes: Describe the notation of exception handling React correctly when certain exceptions occur Use Java’s exception-handling facilities effectively in classes and programs 1) Stage J (Journey) 2) Stage a1 (apply) Lab Activities: Activity 1: Java program that extends java Exception class. Solution: class MyException1 extends Exception1 {  private int ex; MyException1(int a)  {   ex=a;  }  public String toString()  {   return "MyException1[" + ex +"] is less than zero";  } }  class Test {  static void sum(int a,int b) throws MyException1  {   if(a<0)   {    throw new MyException1(a);   }   else    {     System.out.println(a+b);    }  }   public static void main(String[] args)  {   try

Programming Fundamentals Lab Manual 13

Programming Fundamentals Lab Manual 13 Statement Purpose: An exception is an object that signals the occurrence of an unusual event during the execution of a program. The process of creating this object that is generated an exception is called throwing an exception. Activity Outcomes: Describe the notation of exception handling React correctly when certain exceptions occur Use Java’s exception-handling facilities effectively in classes and programs   1) Stage J (Journey) Introduction Unit testing can be done in two ways − manual testing and automated testing. Manual Testing Executing a test cases manually without any tool support is known as manual testing. Time-consuming and tedious  − Since test cases are executed by human resources, it is very slow and tedious. Huge investment in human resources  − As test cases need to be executed manually, more testers are required in manual testing. Less reliable  − Manual testing is less reliable, a

Programming Fundamentals Lab Manual 12

Programming Fundamentals Lab Manual 12 Statement Purpose: The java.io package contains nearly every class you might ever need to perform input and output (I/O) in Java. All these streams represent an input source and an output destination. The stream in the java.io package supports many data such as primitives, object, localized characters, etc. Activity Outcomes: Student will be able to: Describe the concept of an I/O stream Explain the difference between text files and binary files Save data Read data 1)       Stage J (Journey) 2)    Stage a1 (apply) Lab Activities: Activity 1: Write a java program to get a files size in bytes? Solution: import java.io.File;  public class Main {     public static long getFileSize(String filename) {        File file = new File(filename);       if (!file.exists() || !file.isFile()) {          System.out.println(&q

Programming Fundamentals Lab Manual 11

Programming Fundamentals Lab Manual 11 Statement Purpose: In this lab you will experiment with the Java Input/Output components by implementing two programs that read input from a file and write output to a file. The java.io package contains nearly every class you might ever need to perform input and output (I/O) in Java. All these streams represent an input source and an output destination. The stream in the java.io package supports many data such as primitives, object, localized characters, etc. Activity Outcomes: Student will be able to: Describe the concept of an I/O stream Explain the difference between text files and binary files Save data Read data 1)    Stage J (Journey) Introduction The character input and output shown so far has used the pre-defined “standard” streams System.in and System.out. Obviously in many real applications it is necessary to access named files. In many programming languages there is a logical (and practica