mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-05 22:37:42 +02:00
Replace tabs with 4 spaces in java
This commit is contained in:
@@ -30,13 +30,13 @@ Multi-line comments look like this.
|
|||||||
* attributes of a Class.
|
* attributes of a Class.
|
||||||
* Main attributes:
|
* Main attributes:
|
||||||
*
|
*
|
||||||
* @author Name (and contact information such as email) of author(s).
|
* @author Name (and contact information such as email) of author(s).
|
||||||
* @version Current version of the program.
|
* @version Current version of the program.
|
||||||
* @since When this part of the program was first added.
|
* @since When this part of the program was first added.
|
||||||
* @param For describing the different parameters for a method.
|
* @param For describing the different parameters for a method.
|
||||||
* @return For describing what the method returns.
|
* @return For describing what the method returns.
|
||||||
* @deprecated For showing the code is outdated or shouldn't be used.
|
* @deprecated For showing the code is outdated or shouldn't be used.
|
||||||
* @see Links to another part of documentation.
|
* @see Links to another part of documentation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Import ArrayList class inside of the java.util package
|
// Import ArrayList class inside of the java.util package
|
||||||
@@ -56,9 +56,9 @@ public class LearnJava {
|
|||||||
// Input/Output
|
// Input/Output
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ouput
|
* Ouput
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Use System.out.println() to print lines.
|
// Use System.out.println() to print lines.
|
||||||
System.out.println("Hello World!");
|
System.out.println("Hello World!");
|
||||||
@@ -78,27 +78,27 @@ public class LearnJava {
|
|||||||
* Input
|
* Input
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// use Scanner to read input
|
// use Scanner to read input
|
||||||
// must import java.util.Scanner;
|
// must import java.util.Scanner;
|
||||||
Scanner scanner = new Scanner(System.in);
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
|
||||||
// read string input
|
// read string input
|
||||||
String name = scanner.next();
|
String name = scanner.next();
|
||||||
|
|
||||||
// read byte input
|
// read byte input
|
||||||
byte numByte = scanner.nextByte();
|
byte numByte = scanner.nextByte();
|
||||||
|
|
||||||
// read int input
|
// read int input
|
||||||
int numInt = scanner.nextInt();
|
int numInt = scanner.nextInt();
|
||||||
|
|
||||||
// read long input
|
// read long input
|
||||||
float numFloat - scanner.nextFloat();
|
float numFloat - scanner.nextFloat();
|
||||||
|
|
||||||
// read double input
|
// read double input
|
||||||
double numDouble = scanner.nextDouble();
|
double numDouble = scanner.nextDouble();
|
||||||
|
|
||||||
// read boolean input
|
// read boolean input
|
||||||
boolean bool = scanner.nextBoolean();
|
boolean bool = scanner.nextBoolean();
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
// Variables
|
// Variables
|
||||||
@@ -752,7 +752,7 @@ class Dog extends Animal
|
|||||||
public void makeSound()
|
public void makeSound()
|
||||||
{
|
{
|
||||||
System.out.println("Bark");
|
System.out.println("Bark");
|
||||||
// age = 30; ==> ERROR! age is private to Animal
|
// age = 30; ==> ERROR! age is private to Animal
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: You will get an error if you used the
|
// NOTE: You will get an error if you used the
|
||||||
|
Reference in New Issue
Block a user