Posts

Showing posts from November 11, 2013

Quantum Internet Benefits

Image
  The quantum internet is a network of quantum computers that are connected together using quantum communication. It has the potential to revolutionize many industries, including: Secure communications: The quantum internet would be inherently secure, as it would be impossible to eavesdrop on quantum communications without being detected. This could be used for applications such as secure financial transactions, government communications, and military applications. Quantum computing: The quantum internet would allow quantum computers to be connected together, which would allow them to solve problems that are currently impossible for classical computers. This could be used for applications such as drug discovery, financial modeling, artificial intelligence, and materials science. Quantum sensors: The quantum internet could be used to connect quantum sensors together, which would allow them to create a global network of sensors that could be used to monitor the environment, detect earthq

Linux Terminal Commands

Image
Install Command sudo apt-get install <package-name> Example: Installing vlc media player sudo apt-get install vlc ls Command ls -l list folders and files with read write permissions and user groups ls -a This command shows hidden files and folders ls -al ls -la Clear Command clear this command clears the screen Manual Command man <command> this command shows manual of the commands example man ls shows manual command of ls q to quit the manual screen back to terminal commands ifconfig command ifconfig command ip network address details netstat command netstat command used to show network status like ip addresses of local and foreign; port, pid, network protocols cat Command   cat  command  concatenate files and print on the standard output.

Java Program: Down casting Inheritence

Image
Program public class downcasting {    public static void main(String[] args)     {      fordd f;      benzz b;      BMWw bm;      carr c,cc,ccc;      c=new fordd();      cc=new benzz();      ccc=new BMWw();      f=(fordd)c; // downcasting or narrowing or specialization      b=(benzz)cc;      bm=(BMWw)ccc;      f.car();      b.car();      bm.car();     } } class carr {     void car()     {         System.out.println("This super class car method");     } } class fordd extends carr {     void car()     {         System.out.println("This sub class Ford car method");     } } class benzz extends carr {      void car()     {         System.out.println("This sub class Benz car method");     } } class BMWw extends carr {      void car()     {         System.out.println("This sub class BMW car method");     } } Output

Java Program: Up casting Program in inheritance

Image
Program public class upcasting {    public static void main(String[] args)     {      car c,cc,ccc,o;      o=new car();      o.car(); //no casting      c=(car)new ford(); //upcasting ford sub class to super class      c.car();      cc=(car)new benz();//upcasting ford sub class to super class      cc.car();      ccc=(car)new BMW();//upcasting ford sub class to super class            ccc.car();         } } class car {     void car()     {         System.out.println("This super class car method");     } } class ford extends car {     @Override     void car()     {         System.out.println("This sub class Ford car method");     } } class benz extends car {      @Override     void car()     {         System.out.println("This sub class Benz car method");     } } class BMW extends car {      @Override     void car()     {         System.out.println("This sub class BMW car method");     } } Output

Java Program: Inheritance Super Keyword

Image
Program class inheritance {  public static void main(String[] args)  {   apple a=new apple();   a.disp();  } } class fruit {  String f="fruit";  public void disp()  {   System.out.println("Base Class "+f);  } } class apple extends fruit {  String f="Apple";  public void disp()  {   System.out.println("Derived Class  "+f);   super.disp();   System.out.println("Super Class "+super.f);  } } Output

Java Program: File I/O Fileoutputstream to create file

Image
Program import java.io.*; public class createfile {     public static void main(String[] args)     {         try         {         createfile();         }         catch(Exception ex)         {             System.out.println("File Exceptio occured");         }         }     public static void createfile() throws java.io.IOException     {         DataInputStream d=new DataInputStream(System.in);         FileOutputStream f=new FileOutputStream("jack.txt",true);         BufferedOutputStream b=new BufferedOutputStream(f,1024);         System.out.println("Enter $ at the end to finish text");         char c;         while((c=(char)d.read())!='$')         {             b.write(c);                   }         b.close();     } } Output

Java Program: AWT Frame Closing Event

Image
Program import java.awt.*; import java.awt.event.*; public class awtexample extends Frame{     public static void main(String[] args)     {         Frame f= new Frame("New Frame");         f.setSize(400, 500);         f.setVisible(true);         f.addWindowListener(new WindowAdapter(){         public void windowClosing(WindowEvent e)         {         System.exit(0);         }      });     } } Output