View RSS Feed

All Blog Entries

  1. Initializing

    by , 02-01-2012 at 07:23 PM
    Java Code:
    package myPackage;
    
    public class SprinklerSystem 
    {
    	private String valve1;
    	private int valveStrength;
    	private WaterSource source = new WaterSource();
    	
    	static 
    	{
    		System.out.println("You are in Static block!");
    	}
    
    	{
    		System.out.println("You are in initi block!");
    		this.valve1 = "Valve1 ";
    	}
    	
    
    	
    	SprinklerSystem()
    ...
    Categories
    Uncategorized
  2. Casting with Class: Class.

    by , 01-28-2012 at 09:21 PM
    Java Code:
    public class ClassCasts 
    {
    	
    	public static void main(String args[])
    	{
    		Building b = new House();
    		Class<House> houseType = House.class;
    		House h = houseType.cast(b);
    		System.out.println(b.getClass());
    	}
    
    }
    Categories
    Uncategorized
  3. Using of Class Class. An Example:

    by , 01-28-2012 at 11:30 AM
    Java Code:
    package myPackage1;
    
    interface HasBatteries{};
    interface Waterproof{};
    interface Shoots{};
    
    class Toy
    {
    	Toy(){};
    	Toy(int i){};
    }
    
    class FancyToy extends Toy implements HasBatteries,Waterproof,Shoots
    {
    	FancyToy()
    	{
    		super(1);
    	}
    }
    
    public class ToyTest 
    {
    	static void printInfo(Class cc)
    	{
    		System.out.println("Class name:
    ...
    Categories
    Uncategorized
  4. Reading a Files first line with a simple gui application

    by , 01-16-2012 at 12:12 AM
    Java Code:
    package myPackage;
    
    import java.awt.Container;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.util.Scanner;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JTextField;
    
    public class FileOrganizer extends JFrame implements ActionListener 
    {
    	public
    ...
    Categories
    Uncategorized
  5. Reading Byte From a Text File and Printing To Console Character And Byte Value

    by , 01-14-2012 at 12:12 PM
    Java Code:
    public static void main(String[] args) 
    	{
    		File myText = new File("c:/myDir/myText.txt");
    		
    		try {
    			InputStream myByteReader = new FileInputStream(myText);
    			System.out.println("Available total bytes:" + myByteReader.available());
    			int firstByte = myByteReader.read();
    			System.out.println("First byte:" + firstByte);
    			System.out.println("Char of first byte:" + (char) firstByte);
    ...
    Categories
    Uncategorized
  6. Reading Bytes from a Text File

    by , 01-14-2012 at 12:48 AM
    Java Code:
    package myPackage;
    
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.FilterOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.io.OutputStream;
    import java.io.PrintStream;
    import java.io.PrintWriter;
    import java.io.Serializable;
    ...
    Categories
    Uncategorized
  7. Writing an Array Object to a Binary File and Reading Back

    by , 01-14-2012 at 12:03 AM
    Java Code:
    package myPackage;
    
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.FilterOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.io.OutputStream;
    import java.io.PrintStream;
    import java.io.PrintWriter;
    import java.io.Serializable;
    ...
    Categories
    Uncategorized
Page 26 of 48 FirstFirst ... 16242526272836 ... LastLast