Thursday, August 4, 2016

Notes Day 1 AIT


 Batch 2 feedback link for day 2

Day 1 Notes refer
Java overview
JVM details
Basic syntax
basic data types





Day2  example 2

Testarray.java


class Testarray{  
static void min(int arr[]){  
int min=arr[0];  
for(int i=1;i
 if(min>arr[i])  
  min=arr[i];  
  
System.out.println(min);  
}  
  
public static void main(String args[]){  
  
int a[]={33,3,4,5};  
min(a);//passing array to method  
  
}}  



Example 3
Following example demonstrates to convert an array into a collection Arrays.asList(name) method of Java Util class.

import java.util.*;
import java.io.*;

public class ArrayToCollection{
   public static void main(String args[]) 
   throws IOException{
      BufferedReader in = new BufferedReader
      (new InputStreamReader(System.in));
      System.out.println("How many elements 
      you want to add to the array: ");
      int n = Integer.parseInt(in.readLine());
      String[] name = new String[n];
      for(int i = 0; i < n; i++){
         name[i] = in.readLine();
      }
      List list = Arrays.asList(name); 
      System.out.println();
      for(String li: list){
         String str = li;
         System.out.print(str + " ");
      }
   }
}


Exception
Multithread 
Inheritance 

Program examples 1

package com.ait.mt;

/* @author Vipin_Nittoor
MultiThreadExample .java
 */

public class MultiThreadExample {
    public static void main(String[] args) throws InterruptedException {
        Printstar p= new Printstar();
        p.start();
     
     
        for (int i = 0; i < 20; i++) {
            System.out.println(" +");
            Thread.sleep(100);
        }
    }
}

/**********************/
/*   Printstar.java
 */
package com.ait.mt;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *           Printstar.java    
 * @author Vipin_Nittoor
 */
public class Printstar extends Thread {
    @Override
    public void run()
    {
        for (int i = 0; i < 20; i++) {
          System.out.println("*"); 
            try {
                this.sleep(100);
            } catch (InterruptedException ex) {
                Logger.getLogger(Printstar.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        
    }
}

Thursday, April 22, 2010

Girl's Diary VS boy's Diary

HER DIARY

=========

Day night, I thought he was acting
weird. We had made plans to meet at a
cafe to have some coffee. I was shopping with my friends
all day long, soIely thought he was upset at the fact that I
was a bit late,
but he made no comment.Conversation wasn't flowing so

I suggested that we go somewhere quiet so we could talk, he agreed but
he kept quiet and absent. I asked
him what was wrong - he said,

"Nothing."I asked him if it was my fault that he was upset. He said it had
nothing to do with me and not to worry.

On the way home I told him that I loved him, he simply smiled and kept
driving. I can't explain his behavior; I don't know why he didn't say, "I love u,too."
When we got home I felt as if I had lost him, as if he wanted nothing to do with me anymore.
He just sat there and watched TV.; he seemed distant and absent.Finally I
decided to go to bed. About 10 minutes later he came to bed. I decided
that I could not take it anymore,
so I decided to confront him with the situation but he had fallen asleep.

I started crying and cried until I too fell asleep.. I don't know what to
do. I'm almost sure that his thoughts are with someone else.

My life is gonna be a disaster.
_______________________________

HIS DIARY

==========

Today India lost the cricket match
against bangladesh..

DAMN
IT.


Simplicity of Men
Vs
Complexity of Women !!!

Java 2 Enterprise Edition..... An Introduction...

Java 2 Enterprise Edition..... An Introduction...