Tutorialspoint

HTML abbr Tag

<!DOCTYPE html>
<html>

   <head>
      <title>HTML abbr Tag</title>
   </head>

   <body>
      <p>
         <abbr title = "Private">pvt.</abbr>
         <br />
         
         <abbr title = "International Cricket Council">ICC.</abbr> 
            promotes the global game.
         <br />
      </p>
   </body>

</html>

The Finally Block

public class ExcepTest {

   public static void main(String args[]) {
      int a[] = new int[2];
      try {
         System.out.println("Access element three :" + a[3]);
      }catch(ArrayIndexOutOfBoundsException e) {
         System.out.println("Exception thrown  :" + e);
      }finally {
         a[0] = 6;
         System.out.println("First element value: " + a[0]);
         System.out.println("The finally statement is executed");
      }
   }
}

Catching Exceptions

// File Name : ExcepTest.java
import java.io.*;

public class ExcepTest {

   public static void main(String args[]) {
      try {
         int a[] = new int[2];
         System.out.println("Access element three :" + a[3]);
      }catch(ArrayIndexOutOfBoundsException e) {
         System.out.println("Exception thrown  :" + e);
      }
      System.out.println("Out of the block");
   }
}

Unchecked exceptions

public class Unchecked_Demo {
   
   public static void main(String args[]) {
      int num[] = {1, 2, 3, 4};
      System.out.println(num[5]);
   }
}

FileReader

import java.io.File;
import java.io.FileReader;

public class FilenotFound_Demo {

   public static void main(String args[]) {		
      File file = new File("E://file.txt");
      FileReader fr = new FileReader(file); 
   }
}

HTML - a Tag

<!DOCTYPE html>
<html>

   <head>
      <title>HTML a Tag</title>
   </head>

   <body>
      <p>This is a link to <a href = "http://www.amrood.com">AMROOD.com</a></p>
   </body>
	
</html>

HTML doctype Tag

<!DOCTYPE html>
<html>

   <head>
      <title>HTML doctype Tag</title>
   </head>

   <body>
      <p>doctype declaration <doctype> is mentioned at the starting of
         every HTML document.</p>
   </body>
</html>

ByteArrayOutputStream

import java.io.*;
public class ByteStreamTest {

   public static void main(String args[])throws IOException {
      ByteArrayOutputStream bOutput = new ByteArrayOutputStream(12);

      while( bOutput.size()!= 10 ) {
         // Gets the inputs from the user
         bOutput.write("hello".getBytes());  
      }
      byte b [] = bOutput.toByteArray();
      System.out.println("Print the content");
      
      for(int x = 0; x < b.length; x++) {
         // printing the characters
         System.out.print((char)b[x]  + "   "); 
      }
      System.out.println("   ");

      int c;
      ByteArrayInputStream bInput = new ByteArrayInputStream(b);
      System.out.println("Converting characters to Upper case " );
      
      for(int y = 0 ; y < 1; y++ ) {
         while(( c = bInput.read())!= -1) {
            System.out.println(Character.toUpperCase((char)c));
         }
         bInput.reset(); 
      }
   }
}

HTML Comment tag

<!DOCTYPE html>
<html>

   <head>
      <title>HTML <!--....--> Tag</title>
   </head>

   <body>
      <comment>This is a commented line in IE</comment>
      
      <!-- This is a commented line supported by almost every browser.
         It will not appear in output as its a comment. 
      -->
   </body>

</html>

HTML Layouts - Using DIV, SPAN

<!DOCTYPE html>
<html>

   <head>
      <title>HTML Layouts using DIV, SPAN</title>
   </head>

   <body>
      <div style = "width:100%">
		
         <div style = "background-color:#b5dcb3; width:100%">
            <h1>This is Web Page Main title</h1>
         </div>
			
         <div style = "background-color:#aaa; height:200px; width:100px; float:left;">
            <div><b>Main Menu</b></div>
            HTML<br />
            PHP<br />
            PERL...
         </div>
			
         <div style = "background-color:#eee; height:200px; width:350px; float:left;" >
            <p>Technical and Managerial Tutorials</p>
         </div>
		
         <div style = "background-color:#aaa; height:200px; width:100px; float:right;">
            <div><b>Right Menu</b></div>
            HTML<br />
            PHP<br />
            PERL...
         </div>
			
         <div style = "background-color:#b5dcb3; clear:both">
            <center>
               Copyright © 2007 Tutorialspoint.com
            </center>
         </div>
			
      </div>
   </body>

</html>

Advertisements
Loading...