Skip to content

Instantly share code, notes, and snippets.

View dinsaw's full-sized avatar
💭
I may be slow to respond.

Dinesh Sawant dinsaw

💭
I may be slow to respond.
View GitHub Profile
/**
* Following program demonstrates use of Comparable and Comparator in java
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
@dinsaw
dinsaw / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@dinsaw
dinsaw / SerializableDemo.java
Last active August 29, 2015 14:11
Demo for saving object state to local file and reading object from file.
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
/**
* Created by dsawant on 12/13/2014.
* for all example source code visit : https://github.com/dinsaw/abjava
student = Student{name='Din', rollNum=1, course='CS'}
Object saved.
Object read completed.
student1 = Student{name='Din', rollNum=1, course='null'}
@dinsaw
dinsaw / stud.data
Created December 13, 2014 19:17
SerializableDemo persistance file
��sr"in.blogspot.abjava.concept.Student5@چg�IrollNumLnametLjava/lang/String;xptDin
In main before change x = 10
In change x = 5
In main after change x = 10
In main before change point = java.awt.Point[x=10,y=10]
In change point = java.awt.Point[x=5,y=5]
In main after change point = java.awt.Point[x=5,y=5]
In main before change arrayOfInt[0] = 1
In change arrayOfInt[0] = 5
In main after change arrayOfInt[0] = 5
@dinsaw
dinsaw / SuperDemo.java
Last active August 29, 2015 14:12
Using keyword super in java
/**
* Created by dinsaw on 1/4/2015. Part of javacodebit
*/
public class SuperDemo {
static final int KEY = 8;
public static void main(String[] args) {
ExtendedSuperBit bit = new ExtendedSuperBit(10, "Bitman");
System.out.println("Initialized bit = " + bit.getCode());
bit.encrypt(KEY);
Initialized bit = 10
encrypt: subtraction
encrypt: multiplication
Encrypted bit = 16
decrypt: divide
decrypt: addition
Decrypted bit = 10