Skip to content

Instantly share code, notes, and snippets.

@thetekst
thetekst / gist:766124
Created January 5, 2011 10:08
form01
<html>
<head>
<script language="JavaScript">
function Complete()
{
var nameIdt = document.getElementById('yourName').value;
if (document.getElementById('yourName').value = true) {
document.write(nameIdt);
}
@thetekst
thetekst / gist:833400
Created February 18, 2011 08:01
1.2 Java home
/*Напишите программу, которая вводит число, а
выводит на единичку больше.*/
import java.util.Scanner;
public class HelloWorld {
/**
* @param args
*/
public static void main(String[] args) {
@thetekst
thetekst / gist:833403
Created February 18, 2011 08:04
1.4 Java home
System.out.println("Введите ваше имя:");
String name = in.nextInt();
System.out.println("Выберите ваш пол:\n1 - мужской\n2 - женский");
String sex = in.nextInt();
if(sex == 1) {
System.out.println("Уважаемый " + name);
}
else {
System.out.println("Уважаемая " + name);
}
@thetekst
thetekst / gist:833397
Created February 18, 2011 07:56
1.1 Java home
/*Напишите программу «повторюшку», которая вводит
строчку с клавиатуры, а затем её же и выводит.*/
import java.util.Scanner;
public class HelloWorld {
/**
* @param args
*/
public static void main(String[] args) {
@thetekst
thetekst / gist:833402
Created February 18, 2011 08:03
1.3 Java home
/*Напишите программу, которая вводит положительное
число, а выводит значение его квадратного корня.*/
import java.util.Scanner;
import static java.lang.Math.sqrt;
public class HelloWorld {
/**
* @param args
*/
@thetekst
thetekst / gist:833671
Created February 18, 2011 13:50
MultiplicationTable
public class MultiplicationTable {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Таблица умножения\n");
for(int i = 1; i < 10; i++){
for(int k = 1; k < 10; k++){
@thetekst
thetekst / gist:836673
Created February 21, 2011 05:03
exx Crocodile
public class Crocodile {
private long t;
private boolean state;
public Crocodile(){//создание крокодила
}
public double getWeight(){//возвращает вес
return 45;
}
@thetekst
thetekst / gist:837469
Created February 21, 2011 18:22
MyClass
public class MyClass {
private int myClassPropeties;
void setMyClassPropeties(int number){ //или void setMyClassPropeties(int myClassPropeties){
myClassPropeties = number; //тогда здесь this.myClassPropeties = myClassPropeties;
}
int getMyClassPropeties(){
return myClassPropeties;
}
@thetekst
thetekst / gist:837665
Created February 21, 2011 20:32
square
public class MyClass {
private double width;
private double height;
void setValues(double width, double height){
this.width = width;
this.height = height;
}
double getSq(){
@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);
}
}
}