Skip to content

Instantly share code, notes, and snippets.

@thetekst
thetekst / gist:852756
Created March 3, 2011 13:26
Цикл for-each - вывод чисел в массиве
public class Main{
public static void main( String [] args ) {
int[] a = {5, 9, 7};
for(int el: a){
System.out.println(el);
}
}
}
@thetekst
thetekst / gist:854853
Created March 4, 2011 15:53
GregorianCalendar вывод даты
import java.util.Calendar;
import java.util.GregorianCalendar;
public class Main{
public static void main( String [] args ) {
GregorianCalendar kk = new GregorianCalendar();
//int br = kk.get(Calendar.YEAR);
System.out.println("YEAR: " + kk.get(Calendar.YEAR));
}
@thetekst
thetekst / gist:856745
Created March 5, 2011 21:40
eclipse.swt
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class NN {
@thetekst
thetekst / gist:862832
Created March 9, 2011 19:41
SumResult
import java.util.*;
public class SumResult {
private String name;
private double salary;
private Date hireDay;
public SumResult(String n, double s, int year, int month, int day){
name = n;
salary = s;
@thetekst
thetekst / gist:862835
Created March 9, 2011 19:42
TestSumResult
public class TestSumResult {
public static void main(String[] args) {
SumResult[] staff = new SumResult[3];
staff[0] = new SumResult("Carl", 75000, 1987, 12, 15);
staff[1] = new SumResult("Harry", 5000, 1989, 9, 13);
staff[2] = new SumResult("Tony", 42000, 1983, 5, 23);
@thetekst
thetekst / gist:887615
Created March 25, 2011 20:58
MyThread
public class MyThread {
public static void main(String[] args) {
new NameRunn("Один").start();
new NameRunn("Два").start();
new NameRunn("Три").start();
}
}
class NameRunn extends Thread {
@thetekst
thetekst / gist:889518
Created March 27, 2011 19:41
print Date and Hello World
package ru.thetekst.util;
public class Hello {
public static void main(String[] args) {
System.out.println(new java.util.Date() + " Привет мир");
}
}
@thetekst
thetekst / gist:1087332
Created July 17, 2011 07:51
форма
<!-- index.html -->
<html>
<head>
<title></title>
</head>
<body>
<form action="formdata.php" method="POST" name="form1">
<p><input type="submit" name="submit" value="Отправить"></p>
<?
$money = 100;
$shop = true;
if($shop && $money) {
echo "Go to shop";
if($money > 10){
echo "pricelist";
}
}
@thetekst
thetekst / gist:1302182
Created October 20, 2011 20:06
Alligator
package ru.thetekst.crocodile;
public class Crocodile {
private long t;
private boolean alive;
public Crocodile() {
t = System.currentTimeMillis();
alive = true;
}