Tutorialspoint

css orphans

<html>
   <head>
      <style type = "text/css">
         p {orphans: 3;}
         h1 {orphans: 5;}
      </style>
   </head>
   <body>
      <p>Tutorialspoint.com</p>
      <h1>Tutorialspoint.com</h1>
   </body>
</html> 

PHP Function array_shift()

<?php 
   $input = array("a"=>"banana","b"=>"apple","c"=>"Mango");
   
   print_r(array_shift($input));
   print_r("\n");
   print_r(array_shift($input));
?> 

No Instance

package com.tutorialspoint;

public class GenericsTester {
   public static void main(String[] args) 
      throws InstantiationException, IllegalAccessException {
      Box<String> stringBox = new Box<String>();
      add(stringBox, String.class);
   }  

   public static <T> void add(Box<T> box) {
      //compiler error
      //Cannot instantiate the type T
      //T item = new T();  
      //box.add(item);
   }

   public static <T> void add(Box<T> box, Class<T> clazz) 
      throws InstantiationException, IllegalAccessException{
      T item = clazz.newInstance();   // OK
      box.add(item);
      System.out.println("Item added.");
   }   
}

class Box<T> {
   private T t;

   public void add(T t) {
      this.t = t;
   }

   public T get() {
      return t;
   }   
}

css print marks

<html>
   <head>
      <style>
         mark {
            background-color: yellow;
            color: black;
         }
      </style>
   </head>
   <body>
      <p>Tutorialspoint.com</p>
      
      <mark>Tutorialspoint.com</mark>
      <p>Tutorialspoint.com</p>
   </body>
</html> 

Generic Methods Erasure

package com.tutorialspoint;

public class GenericsTester {
   public static void main(String[] args) {
      Box<Integer> integerBox = new Box<Integer>();
      Box<String> stringBox = new Box<String>();

      integerBox.add(new Integer(10));
      stringBox.add(new String("Hello World"));
      
      printBox(integerBox);
      printBox1(stringBox);
   }
   
   private static <T extends Box> void printBox(T box) {
      System.out.println("Value: " + box.get());
   }
   
   private static <T> void printBox1(T box) {
      System.out.println("Value: " + ((Box)box).get());
   }
}

class Box<T> {
   private T t;

   public void add(T t) {
      this.t = t;
   }

   public T get() {
      return t;
   }   
}

PHP Function array_search()

<?php
   $input = array("a"=>"banana","b"=>"apple","c"=>"Mango");
   
   print_r(array_search("apple", $input));
?> 

css word spacing

<html>
   <head>
   </head>
   <body>
      <p style = "word-spacing:5px;">
         This text is having space between words.
      </p>
   </body>
</html> 

PHP Function array_reverse()

<?php
   $input = array("a"=>"banana","b"=>"mango","c"=>"orange");
   
   print_r(array_reverse($input));
?>

css whitespace

<html>
   <head>
   </head>
   <body>
      <p style = "white-space:pre;">
         This text has a line break and the white-space pre setting 
            tells the browser to honor it just like the HTML pre tag.
      </p>
   </body>
</html> 

css text transform

<html>
   <head>
   </head>
   <body>
      <p style = "text-transform:capitalize;">
         This will be capitalized
      </p>
      
      <p style = "text-transform:uppercase;">
         This will be in uppercase
      </p>
      
      <p style = "text-transform:lowercase;">
         This will be in lowercase
      </p>
   </body>
</html>

Advertisements
Loading...