COURSES
MBAData Science & AnalyticsDoctorate Software & Tech AI | ML MarketingManagement
Professional Certificate Programme in HR Management and AnalyticsPost Graduate Certificate in Product ManagementExecutive Post Graduate Program in Healthcare ManagementExecutive PG Programme in Human Resource ManagementMBA in International Finance (integrated with ACCA, UK)Global Master Certificate in Integrated Supply Chain ManagementAdvanced General Management ProgramManagement EssentialsLeadership and Management in New Age BusinessProduct Management Online Certificate ProgramStrategic Human Resources Leadership Cornell Certificate ProgramHuman Resources Management Certificate Program for Indian ExecutivesGlobal Professional Certificate in Effective Leadership and ManagementCSM® Certification TrainingCSPO® Certification TrainingLeading SAFe® 5.1 Training (SAFe® Agilist Certification)SAFe® 5.1 POPM CertificationSAFe® 5.1 Scrum Master Certification (SSM)Implementing SAFe® 5.1 with SPC CertificationSAFe® 5 Release Train Engineer (RTE) CertificationPMP® Certification TrainingPRINCE2® Foundation and Practitioner Certification
Law
Job Linked
Bootcamps
Study Abroad
MS in Data AnalyticsMS in Project ManagementMS in Information TechnologyMasters Degree in Data Analytics and VisualizationMasters Degree in Artificial IntelligenceMBS in Entrepreneurship and MarketingMSc in Data AnalyticsMS in Data AnalyticsMS in Computer ScienceMaster of Science in Business AnalyticsMaster of Business Administration MS in Data ScienceMS in Information TechnologyMaster of Business AdministrationMS in Applied Data ScienceMaster of Business Administration | STEMMS in Data AnalyticsM.Sc. Data Science (60 ECTS)Master of Business AdministrationMS in Information Technology and Administrative Management MS in Computer Science Master of Business Administration Master of Business Administration-90 ECTSMSc International Business ManagementMS Data Science Master of Business Administration MSc Business Intelligence and Data ScienceMS Data Analytics MS in Management Information SystemsMSc International Business and ManagementMS Engineering ManagementMS in Machine Learning EngineeringMS in Engineering ManagementMSc Data EngineeringMSc Artificial Intelligence EngineeringMPS in InformaticsMPS in Applied Machine IntelligenceMS in Project ManagementMPS in AnalyticsMS in Project ManagementMS in Organizational LeadershipMPS in Analytics - NEU CanadaMBA with specializationMPS in Informatics - NEU Canada Master in Business AdministrationMS in Digital Marketing and MediaMSc Sustainable Tourism and Event ManagementMSc in Circular Economy and Sustainable InnovationMSc in Impact Finance and Fintech ManagementMS Computer ScienceMS in Applied StatisticsMaster in Computer Information SystemsMBA in Technology, Innovation and EntrepreneurshipMSc Data Science with Work PlacementMSc Global Business Management with Work Placement MBA with Work PlacementMS in Robotics and Autonomous SystemsMS in Civil EngineeringMS in Internet of ThingsMSc International Logistics and Supply Chain ManagementMBA- Business InformaticsMSc International ManagementMBA in Strategic Data Driven ManagementMSc Digital MarketingMBA Business and MarketingMaster of Business AdministrationMSc in Sustainable Global Supply Chain ManagementMSc Digital Business Analytics MSc in International HospitalityMSc Luxury and Innovation ManagementMaster of Business Administration-International Business ManagementMS in Computer EngineeringMS in Industrial and Systems EngineeringMSc International Business ManagementMaster in ManagementMSc MarketingMSc Business ManagementMSc Global Supply Chain ManagementMS in Information Systems and Technology with Business Intelligence and Analytics ConcentrationMSc Corporate FinanceMSc Data Analytics for BusinessMaster of Business AdministrationMaster of Business AdministrationMaster of Business AdministrationMSc in International FinanceMSc in International Management and Global LeadershipMaster of Business AdministrationBachelor of BusinessMaster of Business Administration 60 ECTSMaster of Business Administration 90 ECTSMaster of Business Administration 90 ECTSBachelor of Business AnalyticsBachelor of Information TechnologyMaster of Business AdministrationMBA Business AnalyticsMSc in Marketing Analytics and Data IntelligenceMS Biotechnology Management and EntrepreneurshipMSc in Luxury and Fashion ManagementMaster of Business Administration (90 ECTS)Bachelor of Business Administration (180 ECTS)B.Sc. Computer Science (180 ECTS) MSc in International Corporate Finance MSc in Sustainable Luxury and Creative IndustriesMSc Digital MarketingMSc Global Supply Chain Management (PGMP)MSc Marketing (PGMP)MSc Corporate Finance (PGMP)MSc Data Analytics for Business (PGMP)MS Business AnalyticsMaster of Business AdministrationMS Quantitative FinanceMS Fintech Management
For College Students

Introduction to Data Types in Java - II

$$/$$

Till now you have learned about the following data types:

  1. int

  2. long

  3. short

  4. float

  5. double

Now let us take a look at a data type that can be used to store characters.

$$/$$

Video Transcript

 

Now, another important data type which we will be taking a look at is called as the Care Data type. Now suppose you wish to store single characters inside your Java program inside your variables, then you can use the data type. Care data type is used to store only single characters. These single characters can be letters or single digits or other special symbols. So for declaring a new Care, I say that care x equals two. And whenever I assign a value inside this Care, I always enclose the value inside single quotes. So I say single quote open and suppose to this XCAR, I wish to assign character A, then I declare it like this. Moreover, I can also write statements such as care y equals to and store some digits inside this. For example, I store the digit five inside this. So this five will actually not be treated as an integer, but it will be treated as a character that is a letter, English alphabet, or the single digit five. Similarly, you can also store some special characters such as the dollar symbol inside the car data type. So notice that whenever you are declaring a new character, you must always enclose them within single quotes and there is exactly one letter or one character which you can store inside the Care data type. So do you think that statements such as care B equal to CD are valid? Well, I just now told you that the Care data type can only store a single letter or a single alphabet. So statements such as these where you are storing multiple letters are invalid. And when you try to write these statements and run them, Java program will show you an error. Similarly, you can use other data types to store multiple characters about them. We are going to take a look at a bit later, but for now, remember that the Care data type is again a 16 bit data type type and strictly stores a single letter or alphabet inside it. Moreover, I can also store numbers inside it. But these numbers or these digits will be treated as a piece of character rather than integers or whole

 

Video Recap

 

 

  • Care data type is used to store single characters in Java programs.

  • It can store letters, single digits, and special symbols.

  • A new Care is declared by writing "care x = 'A'" with the value enclosed in single quotes.

  • You can also store numbers, but they will be treated as a character rather than an integer.

  • Statements such as "care B = CD" are invalid because the Care data type can only store a single letter or alphabet.

  • The Care data type is a 16-bit data type.

  • Other data types can be used to store multiple characters, which will be discussed later.

 

You have already seen data types which can store integers, decimal numbers or characters. Let us now move on to a data type called boolean. A boolean can store only one bit of data. Let us now take a look at how this happens and what is the utility of this data type.

$$/$$

We discussed the boolean data type, which can take only a true or false value. It can take a condition as an input and will return ‘true’ or ‘false’, depending on whether the condition is true or false.

 

The last of the data types is a byte. This is a data type of the smallest size.

Let us take a look at what it can store.

$$/$$

As you saw, a byte can store only an 8-bit integer ranging from till  -1  .

 

You also learnt that the data types we discussed are called primitive data types since they are the building blocks for all other data types.

 

Let us now take a look at how we can initialize and use all these data types in Java.

You can download the following java file which will be very useful to you while watching the video. Right click on the java file and open it with IntelliJ. Please be careful with the name of the java file. The name of the java file should exactly be same as the class name inside it for the code to run. So make changes accordingly.