CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching language of Java
public class OracleJdbcTest
{
    String driverClass = "oracle.jdbc.driver.OracleDriver";
 
    Connection con;
 
    public void init(FileInputStream fs) throws ClassNotFoundException, SQLException, FileNotFoundException, IOException
    {
        Properties props = new Properties();
        props.load(fs);
Today @ 2:42am
Tags:
5 Views
no comments
 
import javax.swing.*;
 
public class MyStringClass 
{
    static int i;
    static String reverseThis;
    static String inputString;
 
    public static void main(String [] args)
    {
Yesterday @ 7:55pm
Tags:
7 Views
no comments
 
public LinkedList<Student> getSortedList (){
        
        LinkedList<Student> sorted = studentList;
        Collections.sort(sorted, new Comparator<LinkedList<Student>>() {
             public int compareTo(LinkedList<Student> stud1, LinkedList stud2)
                {
                     return stud2.get().getMatrnr() - stud1.get().getMatrnr();
                }
        });
        return sorted;
Yesterday @ 4:10am
Tags:
13 Views
no comments
 
public void ParseXMLData() {
     try {
        DocumentBuilder Xml = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        Document Doc = Xml.parse(new File("xmlfile1.xml"));
        Element RootElem = Doc.getDocumentElement();
    } catch (Exception e) {
        System.out.println(e);
    }
}
Sunday @ 3:48am
Tags:
12 Views
no comments
 
public void ParseXMLData() {
     try {
        DocumentBuilder Xml = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        Document Doc = Xml.parse("xmlfile1.xml");
        Element RootElem = Doc.getDocumentElement();
    } catch (Exception e) {
        System.out.println(e);
    }
}
Sunday @ 3:44am
Tags:
11 Views
no comments
 
class wtf{
}
February 02, 2012 @ 5:56am
Tags:
7 Views
no comments
 
class ciao
{}
January 30, 2012 @ 4:31am
Tags:
12 Views
no comments
 
public void writeCourseText() {
    try {
        FileWriter fileWriter = new FileWriter("Courses.txt");
        PrintWriter printWriter = new PrintWriter(fileWriter);
        for (Course course : courses) {
            String Data = course.getCourseName() + "    "
                    + course.getCourseID();
            printWriter.println(Data);
            //Clear Buffer
            printWriter.flush();
by MhdAljobory   December 20, 2011 @ 5:36am
Tags:
21 Views
no comments
 
public int find(String x, int index) {
  if (index < (words.size() - 1)) {
    String current = words.get(index);
    if (current.indexOf(x) >= 0) {
      return 1 + find(x, index++);
    }
    else {
      return 0 + find(x, index++);
    }
  }
by Brian   December 10, 2011 @ 8:18am
Tags:
31 Views
no comments
 
public int find(String x, int index, int count) {
  if (index < (words.size() - 1)) {
    String current = words.get(index);
    if (current.indexOf(x) >= 0) {
      count++;
    }
    find(x, index++, count);
  }
  else {
    return count;
by Brian   December 10, 2011 @ 8:12am
Tags:
32 Views
no comments
 
new ThreadGuest() {
    
    @Override
    public Object run(Handler arg0, long arg1) {
        LogByApp.w("//### 0 ThreadGuest.run()");
        return null;
    }
}
.addChain(0, new ThreadGuest(ThreadGuest.PRIORITY_BELOW_NORMAL) {
    
by arngard   December 07, 2011 @ 4:59am
28 Views
1 comments
 
public String httpResponseAsString(InputStream is, String charset) throws IOException{
        if(is==null){
            return "";
        }
        
        StringBuffer out=new StringBuffer();
        String line ;
        try {
            BufferedReader reader=new BufferedReader(new InputStreamReader(is, charset));
            while ((line=reader.readLine())!=null) {
by x03570227   November 28, 2011 @ 12:16am
28 Views
no comments
 
import java.util.ArrayList;
import java.util.List;
 
    //The ContactList class manages the array of contacts via the addContact and deleteContact methods. It also
    // allows for the retrieval of information from the array with the various 'find' methods.
    // Finally, it allows sorting and printing of the contact list with the print method.
 
    public class ContactList{
 
        private    List<Contact> contactList = new ArrayList<Contact>();
by Monisha Kashyap   November 27, 2011 @ 10:49am
Tags:
20 Views
no comments
 
//The Contact class manages the end objects of the array. Its methods are called by
// methods in the ContactList class. Each Contact object will have several variables
// to store information about last names, first names, addresses, zips and e-mails
 
public class Contact {
    private String lastName, firstName, address, email, zip;
 
    //constructor, sets the values
    public Contact() { //CHANGED 
    }
by Monisha Kashyap   November 27, 2011 @ 10:39am
Tags:
19 Views
no comments
 
// The Main class runs a loop for as long as the user desires. The operations permitted in the loop are to add or delete a contact,
// or to retrieve a contact's info by searching for zip, email or last name. The user may also print the whole list of contacts.
// When the user so commands, the loop will terminate (or more precisely, not run again), and the amended contact list will be saved to file.
 
 
import java.io.*;
 
public class Main {
    public static void main (String args[]) {
by Monisha Kashyap   November 27, 2011 @ 10:30am
Tags:
30 Views
no comments
 
do{
   count ++;
   done = true;
  for (int i = 0;i<length-1;i++){
     vergleiche++;
     if(sort[i]>sort[i+1]){      //left to right
        vertauschung++;
        temp = sort[i+1];
        sort[i+1] = sort[i];
        sort[i]= temp;
by Malte   November 18, 2011 @ 3:05am
Tags:
17 Views
no comments
 
new AsyncNetTask(myContext, myHandler) {
 
    // 작업중에 필요한 변수가 있다면 finalize 하거나 이 객체의 생성자 인자로 넘길 수 있을 것입니다.
    // 유지해야 하는 변수라면 멤버 변수 등을 사용할 수도 있을 것입니다.
    Mydata mData;
 
    @Override
    protected TcpEnvelope onPreExecute() {
        return makeEnvelope();
    }
by arngard   November 17, 2011 @ 8:26pm
30 Views
no comments
 
new ThreadGuest() {
    
    @Override
    public Object run(Handler arg0, long arg1) {
        LogByApp.w("//### 0 ThreadGuest.run()");
        return null;
    }
}
.addChain(0, new ThreadSlave() {
    
by arngard   November 17, 2011 @ 8:18pm
24 Views
no comments
 
println("-----Shakersort-------");
        println();
        print("F0= ");
         for(int x = 0 ;x<length;x++){
            print(" "+sort[x]+" ");
         }
        
         
        int vertauschung = 0;
        int vergleiche = 0;
by Malte   November 17, 2011 @ 6:14am
Tags:
19 Views
no comments
 
public static int binaereSucheB(int anfang, int ende, int find, int[] search){
        int zähler = 0;
        if (anfang>ende){
            return -1;
        }
        int mitte = anfang + ((ende-anfang)/2);
        zähler++;
        if (find > search[mitte]){        
            return binaereSucheB(mitte+1 , ende , find, search);
        }
by Malte   November 17, 2011 @ 5:40am
Tags:
25 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate