ITI 1121 Lecture Notes - Lecture 5: Arity, Primitive Data Type, Object-Oriented Programming
Document Summary
A variable is a plave in memory, to hold a value which we refer to with the help of a label. Comparison operators primitive & reference data types. When it comes to primitive data types, they can be compared directly. Meaning that you can use operations like ==, ,etc. on them and no error will arise. This would make to sense to the compiler because b is an instance of an object. An integer cannot be compared to an object. If you are so fixated on fixing the problem, then the following implementation of the code should work. This class takes in a value of type int and assigns value whatever the instance takes in. Data types are there because they allow the compiler to know how much memory to allocate for each variable. It also gives information about the operations that are allowed on it. There are primitive data types and reference data types.