Skip to content

Instantly share code, notes, and snippets.

@golenishchev
golenishchev / HelloWorldJava.java
Created October 30, 2015 20:35
Learning Java with mentor
public class HelloWorldJava {
public static void main(String[] args) {
System.out.println("Hello World Java");
}
}
@golenishchev
golenishchev / ComputerAccesories.java
Last active November 2, 2015 08:59
Prints out a list of computer accesories
public class ComputerAccesories {
public static void main(String[] args) {
String computerProcessor = "quad core Q6600 Intel processor with frequency 2.4GHz, ";
String memory = "four gigs of RAM, ";
String fans = "Noctua 120mm fans, ";
String videoCard = "Radeon HD 4870 video card, ";
String powerSupply = "450W power supply, ";
String motherBoard = "p5k Asus motherboard, ";
String hardDiscDrive = "512GB HDD, ";
System.out.println("Thats what inside of my PC:");
@golenishchev
golenishchev / Computer.java
Last active November 5, 2015 12:18
questions
class Computer { // Creating class Computer
int powerSupply; // fields
int processor;
int videoCard;
int primaryStorageRam;
int secondaryStorageHdd;
int motherBoard;
int water; // water coolled processor and video card
int turnOnThePower(int powerSupply, int motherBoard) { // methods
@golenishchev
golenishchev / Computer.java
Created November 11, 2015 05:25
Lesson 5. Constructor, object, toString
class Computer { // Creating class Computer
int powerSupply; // fields
float processor;
int videoCard;
int primaryStorageRam;
int secondaryStorageHdd;
String motherBoard;
float water; // water coolled processor and video card
public Computer(int powerSupply, float processor, int videoCard, int primaryStorageRam, int secondaryStorageHdd, String motherBoard, float water) { // constructor
@golenishchev
golenishchev / Computer.java
Created November 17, 2015 07:59
Lesson 6. Getter, setter
class Computer { // Creating class Computer
private int powerSupply; // fields
private float processor;
private int videoCard;
private String motherBoard;
/* getter and setter methods are evil
BEGIN powerSupply */
public int getPowerSupply() {
return powerSupply;
@golenishchev
golenishchev / Computer.java
Last active November 21, 2015 14:12
Lesson7
public class Computer implements java.io.Serializable { // Creating class Computer
private int powerSupply; // fields
private float processor;
private int videoCard;
private String motherBoard;
public Computer() { // default constructor
}
/* getter and setter methods
@golenishchev
golenishchev / Calculator.java
Created November 24, 2015 19:23
Method and Systes.out.println
public class Calculator {
private int a = 4;
private int b = 5;
public int getSum(int a, int b) {
return a + b;
}
public void getResult() {
System.out.println("text");
@golenishchev
golenishchev / Calculator.java
Created November 24, 2015 22:12
в догонку к предыдущему коду
public class Calculator {
private int a = 4;
private int b = 5;
public static void main(String[] args) {
getResult("more text");
}
public int getSum(int a, int b) {
return a + b;
}
public class Calculator {
private int firstNumber;
private int secondNumber;
private int resultValue;
public Calculator() { // Constructor
firstNumber = 10;
secondNumber = 5;
resultValue = getSum();
printResult(resultValue);
@golenishchev
golenishchev / Calculator.java
Last active November 27, 2015 15:54
Lesson 8. Math class. Sqrt, sin methods
class Calculator {
private int firstNumber;
private int secondNumber;
private int resultValue;
private double wowSoSquare;
private double numberBeforeSquareRootExtraction;
private double squareRootCalcResult;
private double angleBeforeSineCalc;
private double sineCalcResult;