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);
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) {
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;
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); } }
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); } }
11 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();
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++); } }
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;
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) {
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) {
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>();
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 }
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[]) {
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;
17 Views
no comments
new AsyncNetTask(myContext, myHandler) { // 작업중에 필요한 변수가 있다면 finalize 하거나 이 객체의 생성자 인자로 넘길 수 있을 것입니다. // 유지해야 하는 변수라면 멤버 변수 등을 사용할 수도 있을 것입니다. Mydata mData; @Override protected TcpEnvelope onPreExecute() { return makeEnvelope(); }
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() {
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;
19 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
