Java SE Bronze Exam Number: 1Z0-818 (Data Declaration and Use) (October 2020)

Official site: Java SE Bronze

oracle.PNG

Purpose

: cherry_blossom: ** Java Bronze SE passed **: cherry_blossom:

table of contents

1, Java data type (primitive type, reference type) 2, Declaration and initialization of variables and constants, valid range of values 3, Declaration, creation and use of arrays (one-dimensional arrays) 4, Use command line arguments

1, Java data type (primitive type, reference type)

** Primitive type **

byte  short  int  long  float  double  boolean  char

** Reference type **

String

2, Declaration and initialization of variables and constants, valid range of values

Variables

Variable.java


class Variable { 
	public static void main(String[] args) {
				
     -- Primitive type --
		byte  a = 1;
		short b = 5;
		int   c = 10;
		long  d = 100L;
		
		float  e = 1.0F;
		double f = 2.00;
		boolean x =  true;
		boolean y = false;
		char z = 'A';
		
	 -- Reference type -- 
		String name = "java";
	}
}

Constant * It is customary to use uppercase letters

Constant.java


class Constant { 
	public static void main(String[] args) {
				
     -- Primitive type --
		final int VALUE = 10;
		
	 -- Reference type -- 
		final String NAME = "java";
	}
}

3, Declaration, creation and use of arrays (one-dimensional arrays)

Array.java


class Array { 
	public static void main(String[] args) {
	
    -- int type --
	int[] numbers = {5, 10, 15, 20};

    -- String type -- 
	String[] subjects = {"Japanease", "Math", "Social", "Sience", "English"};
		
	for (int i = 0; i < numbers.length; i++) {
		System.out.println(numbers[i]);
	}
		
	for (int i = 0; i < subjects.length; i++) {
		System.out.println(subjects[i]);
	}		
     
	}
}

4, Use of command line arguments

CommandLine


> java "Class file name" "Value 1" "Value 2" ...

The main method receives command line arguments as an array of String class

CommandLine.java


class CommandLine { 
	public static void main(String[] args) {

        System.out.println(args[0]);
        System.out.println(args[1]);

        "Frequently used instruction execution statements"
        "Receives one line of string input from the keyboard"
        String s = new java.util.Scanner(System.in).nextLine();
        "Receives one line of integer input from the keyboard"
        int input = new java.util.Scanner(System.in).nextInt();

        System.out.println(s);
        System.out.println(input);
	}
}

Remarks

If you have any ** advice ** or ** comments **, please do: blush: Timely corrections ❗️ 1, Data Declaration and Use 2, Loop statement

Recommended Posts

Java SE Bronze Exam Number: 1Z0-818 (Data Declaration and Use) (October 2020)
Java SE Bronze Exam Number: 1Z0-818 (Loop Statement) (October 2020)
Java SE Bronze (1Z0-818) Passing Experience
Java SE Bronze exam test content
Java variable declaration, initialization, data type (cast and promotion)
[Java Bronze learning] Differences between encapsulation, data hiding, and information hiding
Java SE 8 Sliver exam questions
Java programming (variables and data)
[Introduction to Java] Variables and types (variable declaration, initialization, data type)
Use java with MSYS and Cygwin
Java variable declaration, initialization, and types
Basic data types and reference types (Java)
Use JDBC with Java and Scala.
Orcacla Java Bronze SE 7/8 Qualification Study
Java basic data types and reference types
[Introduction to Java] About array operations (1D array, 2D array declaration, instantiation, initialization and use)