Tutorialspoint

Tcl Library

tcl

#!/usr/bin/tclsh

puts $tcl_library

Tcl Package Path

tcl

#!/usr/bin/tclsh

puts $tcl_pkgPath

Tcl Environment Path

tcl

#!/usr/bin/tclsh

puts $env(PATH)

Tcl Version

tcl

#!/usr/bin/tclsh

puts $tcl_version

java_overview_LabeledContinueExample

public class LabeledContinueExample {
   public static void main(String args[]){
      Task: 
      for(int i=0; i<10; i++){    	  
         if (i==8){        	 
            continue Task;        	 
         }         
      System.out.println("......."+i );    	  
      }	   
   }	
}

java_overview_LabeledBreakExample

public class LabeledBreakExample {
   public static void main(String args[]){
      Task: 
      for(int i=0; i<10; i++){    	  
         if (i==8){        	 
            break Task;        	 
         }         
      System.out.println("......."+i );    	  
      }	   
   }	
}

java_overview_LabeledBreakExample

public class ContinueExample {

   public static void main(String args[]){
	  Task: 
      for(int i=0; i<10; i++){
    	  
         if (i==8){        	 
            continue Task;        	 
         }
         
      System.out.println("......."+i );
    	  
      }
	   
   }
	
}

java_overview_BreakExample

public class BreakExample {
   public static void main(String args[]){
      for(int i=0; i<10; i++){    	  
         if (i==8){        	 
            break;	 
         }         
      System.out.println("......."+i);    	  
      }	   
   }	
}

Protocol Inheritance

protocol classa {
   var no1: Int { get set }
   func calc(sum: Int)
}
protocol result {
   func print(target: classa)
}
class student2: result {
   func print(target: classa) {
      target.calc(sum: 1)
   }
}
class classb: result {
   func print(target: classa) {
      target.calc(sum: 5)
   }
}

class student: classa {
   var no1: Int = 10
   
   func calc(sum: Int) {
      no1 -= sum
      print("Student attempted \(sum) times to pass")
         
      if no1 <= 0 {
         print("Student is absent for exam")
      }
   }
}

class Player {
   var stmark: result!

   init(stmark: result) {
      self.stmark = stmark
   }
   func print(target: classa) {
      stmark.print(target: target)
   }
}

var marks = Player(stmark: student2())
var marksec = student()

marks.print(target: marksec)
marks.print(target: marksec)
marks.print(target: marksec)
marks.stmark = classb()
marks.print(target: marksec)
marks.print(target: marksec)
marks.print(target: marksec)

java_array_JSONArrayToFile

import java.io.FileOutputStream;
import javax.json.Json;
import javax.json.JsonArray;
import javax.json.JsonWriter;

public class JSONArrayToFile {

   public static void main(String args[]) throws Exception{
	   
      JsonArray value = Json.createArrayBuilder()
         .add(Json.createObjectBuilder()
            .add("id", "1001")
            .add("Technology", "JavaFX"))
         .add(Json.createObjectBuilder()
            .add("id", "1002")
            .add("Technology", "OpenCV"))
         .build();
	   
      System.out.println(value);
	   
      JsonWriter writer = Json.createWriter(new FileOutputStream("sampleData"));
      writer.writeArray(value);
      writer.close();			   
	   
   }
	
}

Advertisements
Loading...