0% found this document useful (0 votes)
11 views1 page

Java Lab: Tokens & Control Structures

This lab sheet outlines a Java programming unit lasting 5 hours, focusing on tokens, expressions, and control structures. It includes ten lab questions that cover various programming concepts such as data types, conditional statements, loops, and type conversion. Students are required to write programs that demonstrate these concepts through practical examples.

Uploaded by

twinklestar9817
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

Java Lab: Tokens & Control Structures

This lab sheet outlines a Java programming unit lasting 5 hours, focusing on tokens, expressions, and control structures. It includes ten lab questions that cover various programming concepts such as data types, conditional statements, loops, and type conversion. Students are required to write programs that demonstrate these concepts through practical examples.

Uploaded by

twinklestar9817
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Lab Sheet: Unit 2 – Tokens, Expressions

and Control Structures


Course: Java Programming

Unit Duration: 5 Hours

Lab Questions:
1. Write a Java program to display all primitive data types with default values.
2. Accept a number and determine whether it is even or odd using if-else.
3. Write a Java program to swap two numbers using a temporary variable and also without
using a third variable.
4. Demonstrate use of pre-increment and post-increment operators with output.
5. Accept a character and check whether it is a vowel or consonant using switch-case.
6. Create a program to print multiplication table of a given number using a for loop.
7. Use a while loop to print Fibonacci series up to n terms entered by the user.
8. Demonstrate the use of break and continue within a loop with an example.
9. Use command-line arguments to accept a name and age and print a greeting.
10. Write a Java program to demonstrate type conversion between int, double, and float.

You might also like