INTRO TO JAVA To DATA TYPES (W3Schools)

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/77

flashcard set

Earn XP

Description and Tags

Para sa Quiz on Tuesday Source from w3school From Java Intro to Data types

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

78 Terms

1
New cards

What is Java?

A high-level, object-oriented programming language.

2
New cards

Who developed Java?

Originally by Sun Microsystems, now owned by Oracle.

3
New cards

What is JVM?

Java Virtual Machine — runs Java bytecode on any platform.

4
New cards

What is JDK?

Java Development Kit — includes compiler, JVM, and tools.

5
New cards

What is JRE?

Java Runtime Environment — includes JVM and libraries to run Java apps.

6
New cards

What is bytecode?

Intermediate code compiled from Java source, executed by JVM.

7
New cards

Why is Java platform-independent?

Because bytecode runs on any JVM regardless of OS.

8
New cards

What is an IDE?

Integrated Development Environment — e.g., IntelliJ, Eclipse.

9
New cards

What file extension does Java source use?

.java

10
New cards

What command compiles Java code?

javac MyClass.java

11
New cards

What is the entry point of a Java program?

public static void main(String[] args)

12
New cards

How do you print text in Java?

System.out.println("Hello");

13
New cards

What symbol ends a statement?

; (semicolon)

14
New cards

How are code blocks defined?

{} (open and closed curly brackets)

15
New cards

Is Java case-sensitive?

Yes

16
New cards

Can class names start with a number?

No

17
New cards

What keyword defines a class?

class

18
New cards

What keyword creates an object?

new

19
New cards

What is a constructor?

A method used to initialize objects.

20
New cards

Can a class have multiple constructors?

Yes, via constructor overloading.

21
New cards

Single-line comment syntax?

// comment

22
New cards

Multi-line comment syntax?

/* comment */

23
New cards

No

Do comments affect execution?

24
New cards

Can comments be nested?

No

25
New cards

Why use comments?

To explain code and improve readability.

26
New cards

What is a variable?

A container for storing data

27
New cards

How to declare an integer variable?

int x = 10;

28
New cards

Can variable names contain spaces?

No

29
New cards

What is initialization?

Assigning a value during declaration.

30
New cards

Can variables be reassigned?

Yes, unless declared final.

31
New cards

What is a constant?

A variable whose value cannot change.

32
New cards

How to declare a constant?

final int MAX = 100;

33
New cards

What is camelCase?

Naming convention where first word is lowercase, others capitalized

34
New cards

Naming convention where first word is lowercase, others capitalized

No

35
New cards

Can variable names contain special characters?

Only _ and $ are allowed.

36
New cards

How many primitive types are there?

8

37
New cards

What does byte store?

-128 to 127

38
New cards

What does short store?

-32,768 to 32,767

39
New cards

What does int store?

-2,147,483,648 to 2,147,483,647

40
New cards

What does long store?

-9 quintillion to 9 quintillion

41
New cards

What does float store?

~6–7 decimal digits

42
New cards

What does double store?

~15–16 decimal digits

43
New cards

What does Boolean store?


true or false

44
New cards

What does char store?

A single character

45
New cards

Default value of int?

0

46
New cards

Default value of boolean?

false

47
New cards

Default value of char?

'\u0000'

48
New cards

Default value of float?

0.0f

49
New cards

Default value of double?

0.0d

50
New cards

Default value of long?

0L

51
New cards

How to declare a float?

float f = 5.99f;

52
New cards

How to declare a double?

double d = 19.99;

53
New cards

How to declare a char?

char c = 'A';

54
New cards

How to declare a boolean?

boolean b = true;

55
New cards

How to declare a long?

long l = 123456789L;

56
New cards

What is a non-primitive type?

A type that refers to objects.

57
New cards

Examples of non-primitive types?


String, Array, Class

58
New cards

Can non-primitive types be null?

Yes

59
New cards

Can primitive types be null?

No

60
New cards

Is String a primitive type?

No

61
New cards

Can non-primitive types have methods?

Yes

62
New cards

How to declare a String?

String s = "Hello";

63
New cards

Can you use new with String?

Yes: String s = new String("Hello");

64
New cards

What is the default value of String?

null

65
New cards

Can you compare strings with ==? (More Advanced)

Not reliably — use .equals() instead.

66
New cards

What is type casting?

Converting one data type into another.

67
New cards

What is implicit casting?

Automatic conversion from smaller to larger type.

68
New cards

What is explicit casting?

Manual conversion using (type) syntax.

69
New cards

How to cast double to int?

int x = (int) 9.99;

70
New cards

What is the purpose of data types?

To define the kind of data a variable can hold

71
New cards
72
New cards
73
New cards
74
New cards
75
New cards

Other Types

  • char

  • Boolean

76
New cards

Floating-Point Types

  • float

  • double

77
New cards

Java Primitive Data Types

Integer Types

  • byte

  • short

  • int

  • long

Floating-Point Types

  • float

  • double

Other Types

  • char

  • Boolean

78
New cards

Integer Types

  • byte

  • short

  • int

  • long