1

00:00:01,110  -->  00:00:07,050
Since class object is the entry point for reflection let's not see how we can access a class object

2

00:00:07,050  -->  00:00:08,590
.

3

00:00:08,700  -->  00:00:10,960
There are three ways to access a class object.

4

00:00:11,000  -->  00:00:12,740
And here are those interests.

5

00:00:12,810  -->  00:00:15,820
First one is via an object reference.

6

00:00:16,050  -->  00:00:22,080
That is your code has access to an object reference and you can get the corresponding class object by

7

00:00:22,080  -->  00:00:28,350
invoking the get class method on the object reference get class as a final method in the Object class

8

00:00:28,350  -->  00:00:28,580
.

9

00:00:28,800  -->  00:00:32,600
And it was briefly mentioned when we covered object class.

10

00:00:32,610  -->  00:00:36,550
Second we is to invoke the topic from the method in the class.

11

00:00:36,600  -->  00:00:42,160
Class itself turns to something called class and it grows.

12

00:00:42,180  -->  00:00:43,710
Let's not look at each of these matters.

13

00:00:43,710  -->  00:00:51,500
Two examples hit up a couple of examples when using object reference in the first example.

14

00:00:51,630  -->  00:00:54,060
Get classes in honest cringle occur.

15

00:00:54,470  -->  00:01:01,100
And that would read a class object corresponding boost Krink class in the second example we instantiating

16

00:01:01,100  -->  00:01:08,290
hash set which is a class in Java that Udal package the reference type set is an interface and Javadoc

17

00:01:08,300  -->  00:01:11,400
util package and is implemented bajas said.

18

00:01:11,950  -->  00:01:18,660
No be involved get class on the object reference we get a class object for Hassid class or not for the

19

00:01:18,660  -->  00:01:19,700
certain duffus.

20

00:01:19,710  -->  00:01:21,430
OK so just keep that in mind.

21

00:01:21,780  -->  00:01:25,640
Just not a variable named class which ends with Susy's.

22

00:01:26,010  -->  00:01:31,820
That's just a convention that many don't have much use for variables referencing a class object.

23

00:01:32,010  -->  00:01:38,180
You cannot of course use the named class with suffix s as it is a reserved keyword.

24

00:01:38,240  -->  00:01:45,200
No let's look at the second approach which is to use topical Fortnum method from the class class input

25

00:01:45,210  -->  00:01:48,870
to this method must be a fully qualified name of the class.

26

00:01:49,230  -->  00:01:56,230
Next it cannot be used on primitives if you recall every primitive also has a class object but it's

27

00:01:56,250  -->  00:02:00,420
just that we cannot get the class object using this particular approach.

28

00:02:00,450  -->  00:02:02,750
We can get it to the third approach.

29

00:02:03,290  -->  00:02:05,160
Now here are a few examples.

30

00:02:05,160  -->  00:02:07,250
The first example is straightforward.

31

00:02:07,370  -->  00:02:12,300
We're fully qualified name or string classes used second third and fourth.

32

00:02:12,300  -->  00:02:14,610
Examples are related to address.

33

00:02:14,700  -->  00:02:21,330
Second example returns a class object corresponding to an army of primitive type double syngas good

34

00:02:21,330  -->  00:02:27,400
record indicates a one dimensional array and characters be represented primitive type double.

35

00:02:27,990  -->  00:02:33,780
If we close two dimensional array there would have been squared brackets like in the last example.

36

00:02:33,780  -->  00:02:38,910
So with each added dimension an additional square brackets would be inserted.

37

00:02:38,910  -->  00:02:43,290
Third example is related to an array of some objects where the object is.

38

00:02:43,440  -->  00:02:51,430
In this case for an object the syntax invokes the last name preceded by the character L and adding with

39

00:02:51,430  -->  00:02:57,720
the semicolon and the semi-colon in the end is required and hence is emphasized in red.

40

00:02:58,060  -->  00:03:05,230
Last example returns as class object corresponding to two dimensional array of type string.

41

00:03:05,240  -->  00:03:06,950
Next let's look at the third approach.

42

00:03:06,970  -->  00:03:12,480
What accessing a class object by appending dot goes to the right name.

43

00:03:12,510  -->  00:03:17,620
We can also get X class object equites with classes interfaces arrays.

44

00:03:17,690  -->  00:03:21,820
But it was too sick and did not work with primitives.

45

00:03:22,020  -->  00:03:25,080
So you would have used this approach for primitives.

46

00:03:25,080  -->  00:03:30,250
Now here are a few examples just wandered into a class object for string.

47

00:03:30,360  -->  00:03:33,830
Second need a class object for primitive boolean.

48

00:03:34,000  -->  00:03:40,350
Third one Regents class object corresponding good three dimensional array of type and find an example

49

00:03:40,350  -->  00:03:45,800
returns a class object for the White keyword reconquered a class object can also be created.

50

00:03:45,850  -->  00:03:53,940
Why you would have a demo where we can see how a class object of white keyword can be useful.

51

00:03:55,020  -->  00:03:59,310
Here are some additional legal support for name and class literal approaches.

52

00:03:59,310  -->  00:04:05,250
These points highlight their differences to first one is about whether or not compiler checks if the

53

00:04:05,250  -->  00:04:08,320
corresponding class file exists on disk.

54

00:04:08,370  -->  00:04:11,890
Compiler does not do any such checks for the form name approach.

55

00:04:11,910  -->  00:04:18,150
The check is put on directly a runtime class not one exception will be raised if the class is not home

56

00:04:18,160  -->  00:04:18,760
.

57

00:04:19,350  -->  00:04:25,950
However for class literal approach compiler checks whether or not the class exists on disk if only source

58

00:04:25,950  -->  00:04:33,030
code exists but not the class when the compiler automatically compiles the source code and so compiler

59

00:04:33,030  -->  00:04:37,380
ensures that the class file is dead on disk not at runtime.

60

00:04:37,380  -->  00:04:42,060
If somehow the dot class one is not found then JVM throws an error code.

61

00:04:42,060  -->  00:04:49,050
No class Duffin error which implies that the class definition existed during compilation time but not

62

00:04:49,080  -->  00:04:50,580
anymore.

63

00:04:50,580  -->  00:04:55,890
Second point is about initialization which is a third stage of the lifetime of type.

64

00:04:56,250  -->  00:04:58,030
With regards to Farnam approach.

65

00:04:58,410  -->  00:05:05,700
Class gets loaded and also initialized but for class Necros only classes are ordered and initialization

66

00:05:05,700  -->  00:05:08,070
happens or even is documented.

67

00:05:08,250  -->  00:05:13,910
Or a static field that is not at compile time constant is access for the very first time.

68

00:05:14,100  -->  00:05:18,360
So that's like a lazy initialization for the classical approach.

69

00:05:18,420  -->  00:05:21,150
We already know the third point of it first name.

70

00:05:21,210  -->  00:05:28,080
We can order class objects for primitives which would be possible with glossily crowds.

71

00:05:28,350  -->  00:05:32,160
Finally there is this field called Type in every box but Amaka.

72

00:05:32,400  -->  00:05:38,630
If you recall baulks primitive is a proper class for a primitive accessing pipe in a box.

73

00:05:38,730  -->  00:05:43,050
Perimeter guilded in the class object for the corresponding perimeter.

74

00:05:43,870  -->  00:05:45,350
Similarly a box would never do.

75

00:05:45,420  -->  00:05:49,210
There is a class called White and Gelug outlying package.

76

00:05:49,380  -->  00:05:55,890
This class also has pipefitter which will return the class object for the White keyword.

77

00:05:55,890  -->  00:06:00,470
Note that word class is non-instructional as it has a private constructor.

78

00:06:01,620  -->  00:06:07,710
So other than using a class literal you can also use a type who used to create a class object for primitives

79

00:06:07,800  -->  00:06:13,420
unboiled and general use in dog class seems to be preferrable using the pipe.

80

00:06:14,160  -->  00:06:16,560
So that support accessing class object.

81

00:06:16,560  -->  00:06:19,230
Next let's do them all gave me explore reflection
