Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
2.6k views
in Information Technology by (53.3k points)

Ruby, a class XI student has just started learning java programming. Help her in the following:

i.  Explain her the concept of variable and data type by suitable example.

ii.  Help her in understanding the difference between assignment operator and comparison operator with the help of appropriate example

1 Answer

+1 vote
by (53.1k points)
selected by
 
Best answer

i. Variables are named storage location to store values temporarily which can be changed during program execution.

Data type states the way the values of that type are stored, the operations that can be done on that type and the range for that type.

For example: 

int marks;

In the above statement, int is the data type and marks is the name of variable which store values temporarily.

ii. Assignment operator (=) is used to assign any value in a variable/constant while comparison operator (= =) is used to compare values.

For example:

int marks=90;

In the above statement value 90 is assigned to the variable named marks.

if(marks==40)

jTextField1.setText(“Just Pass”);

In the above if statement, value of marks is being compared with 40.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...