Svetlana_Ovsjanikova

java - Day3_Classes.examples

Sep 21st, 2019
111
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package day3_classes;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11. *
  12. * @author sao_7
  13. */
  14. public class Example {
  15.  
  16. //private, public
  17. //static
  18. private int maluSkaits;
  19.  
  20. public Example() {
  21. maluSkaits = 0;
  22. }
  23.  
  24. public static void staticExample() {
  25. System.out.println("Static");
  26. }
  27.  
  28. public void nonStaticExample() {
  29. System.out.println("Non static");
  30. }
  31.  
  32. public void whileExample() {
  33. Scanner sc = new Scanner(System.in);
  34. String exit = "";
  35. while (!exit.equals("yes")) {
  36. System.out.println("Izvade!");
  37. exit = sc.nextLine();
  38. exit = exit.toLowerCase();
  39. }
  40.  
  41. }
  42.  
  43. //Uztaisam klasi ar nosaukumu tasks
  44. //statisku metodi, kas izvada
  45. //*
  46. //**
  47. //***
  48. //****
  49. //***
  50. //**
  51. //*
  52. public static void stars() {
  53. String output = "";
  54. for (int i = 0; i < 4; i++) {
  55. output = output + "*";
  56. System.out.println(output);
  57. }
  58.  
  59. //Uztaisat lauku (int) ar nosaukumu a
  60. //konstruktora iedodat vertibu 0
  61. //metodi ar parametru maina vertibu mainigajam a
  62.  
  63.  
  64. //FOR NOW IGNORE
  65. //Uztaisit kalkulatoru
  66. //Matematiskas darbibas jauna klase
  67. //vertibas mes padodam ieksa ar parametriem
  68. //un rezultatu atgriezam return
  69. //Main metode Day3 klasē- izmantojam while ciklu
  70. //lai uztaisam menu
  71. }
  72. }
RAW Paste Data