Muscle Java Basics Day 1

Program diary of fledgling brain muscle Summarize what you have learned

Java features

--Grammar type that follows C / C ++ --Object-oriented language --Static type language --Variables, arguments and return values must be typed! !!

Java Virtual Machine(JVM/JavaVM) --A virtual machine that can interpret and execute Java binary format as it is --Get common execution results by using a dedicated Java VM for each OS

What is a class? !!

--Defining a program that can collectively define states / situations and behaviors / behaviors

Car class condition Behavior / behavior
car_character3_wagon.png Vehicle type
Number of doors
Go down

__ How to define a class __

class class name(){
Define state / situation
Define behavior / behavior

What is a method? !!

--Definition of __ "behavior" and "behavior" __ in the class

__ How to define a method __

class class name(){
Define state / behavior

Return type method name(argument){
Behavior / behavior processing

--Use (call) a method --When the caller calls the method, the processing in the method is executed and the processing result is returned to the caller. --Arguments --When calling the method, pass the information required for processing as __ "argument" __


definition of main method

--What is the main method? --Method executed when the program is started ――The way of definition is decided

public static void main(String[] args){


Data type

Data type Model name Contents Range of values
Integer type int
32-bit integer
64-bit integer
8-bit integer
Real type float
32-bit single precision real number
64-bit single precision real number
Character type char 1 character abridgement
Logical type boolean Two-valued logical value true or false

How to define variables

--Java variables --Java variables always require "type definition" -Unable to assign a value other than the defined type to a variable ――This is called "static typing"

Type name Variable name = Initial value;
int a = 10;

Fields and local variables

--Field --Variables declared inside the class definition --Local variables --Variables declared inside the method definition

public class sample{
  String name = "Taro";

 public void walk(){
  //Local variables
  int age = 20;  

Recommended Posts

Muscle Java Basics Day 1
Java Day 2018
Java basics
Java basics
Muscle Java Object Oriented Day 1
Java basics
java programming basics
Java Day Tokyo 2017
Oracle Java Day 2017
Java JAR basics
Object-oriented (Java) basics
Oracle Java Day 2017
Java concurrency basics
java learning day 2
java learning day 1
[day: 5] I summarized the basics of Java
Java Silver Study Day 1
Java Kuche Day memo
Java programming basics practice-array
Java Network Basics (Communication)
Basics of character operation (java)
4th day of java learning
Java programming basics practice-for statement
Summary of Java language basics
Java programming basics practice-switch statement
Getting Started with Java Basics
Java Development Basics ~ Exercise (Array) ~
[Java11] Stream Usage Summary -Basics-
[Java basics] What is Class?
Java is the 5th day
[Study session memo] Java Day Tokyo 2017
Java Performance Chapter 5 Garbage Collection Basics
Memorandum of new graduate SES [Java basics]
[Java] Get the day of the specific day of the week
[# 1 Java] Basics of Java-Major premise before studying-
Looking back on the basics of Java
Muscle Ruby on Rails Day 1 ~ Environment Construction ~