0% found this document useful (0 votes)
4 views11 pages

Java Work

The document contains multiple Java classes demonstrating unary operations, increment/decrement operations, conditional statements for even/odd checks, marks grading, age evaluation, and vowel/consonant identification. Each class utilizes the Scanner class for user input and prints results based on the conditions specified. The code illustrates fundamental programming concepts in Java, including control flow and arithmetic operations.

Uploaded by

kowsikur2012
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)
4 views11 pages

Java Work

The document contains multiple Java classes demonstrating unary operations, increment/decrement operations, conditional statements for even/odd checks, marks grading, age evaluation, and vowel/consonant identification. Each class utilizes the Scanner class for user input and prints results based on the conditions specified. The code illustrates fundamental programming concepts in Java, including control flow and arithmetic operations.

Uploaded by

kowsikur2012
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

Unary:

package [Link];

import [Link];

public class Unarydemo {

public static void main(String[] args) {

Scanner input = new Scanner([Link]);

int x,result;

[Link](" x is: ");

x = [Link]();

//int x = 10;

//int result;

result = +x;

[Link]("x is: "+result);

result = -x;

[Link]("x is: "+result);

}
IncrementDevrement:

package [Link];

import [Link];

public class IncrementDevrement {

public static void main(String[] args) {

Scanner input = new Scanner([Link]);

//int x = 10;

int x,result;

[Link](" x is: ");

x = [Link]();

result = x++;

[Link]("x is: "+result);

result = x;

[Link]("x is: "+result);

result = x--;

[Link]("x is: "+result);

result = x;

[Link]("x is: "+result);

}
package [Link];

import [Link];

public class IncrementDevrement2 {

public static void main(String[] args) {

Scanner input = new Scanner([Link]);

//int x = 10;

int x,result;

[Link](" x is: ");

x = [Link]();

result = ++x;

[Link]("x is: "+result);

result = x;

[Link]("x is: "+result);

result = --x;

[Link]("x is: "+result);

result = x;

[Link]("x is: "+result);

}
package [Link];

import [Link];

public class IncrementDevrement3 {

public static void main(String[] args) {

Scanner input = new Scanner([Link]);

//int x = 10;

int x,result;

[Link](" x is: ");

x = [Link]();

result = ++x;

[Link]("x is: "+result);

result = x++;

[Link]("x is: "+result);

result = --x;

[Link]("x is: "+result);

result = x--;

[Link]("x is: "+result);

}
Usureinput:

package [Link];

import [Link];

public class usureinput {

public static void main(String[] args) {

Scanner input = new Scanner([Link]);

int x,result;

[Link]("x is");

x = [Link]();

//int x = 25;

//int result;

result = ++x;

[Link]("x is: " + result);

result = x++;

[Link]("x is: " + result);

result = --x;

[Link]("x is: " + result);

result = x--;

[Link]("x is: " + result);

}
EvenOdd:

package [Link];

import [Link];

public class EvenOdd {

public static void main(String[] args) {

Scanner input = new Scanner([Link]);

int digit;

[Link]("Enter & integer number :");

digit = [Link]();

if(digit%2==0){

[Link]("Number is Even");

[Link]("Nrmber is Positive");

else{

[Link]("Number is odd");

[Link]("Number is Negative");

}
MarksDemo:

package [Link];

import [Link];

public class MarksDemo {

public static void main(String[] args) {

Scanner input = new Scanner([Link]);

double marks;

[Link]("Enter your marks: ");

marks = [Link]();

if(marks>=80){

[Link]("A+");

[Link]("Very nice");

else if(marks>=70){

[Link]("A");

[Link]("Good");

else if(marks>=60){

[Link]("A-");

[Link]("Not Bad");
}

else if(marks>=50){

[Link]("B");

[Link]("NOt good");

else if(marks>=40){

[Link]("C");

[Link]("You need care");

else if(marks>=33){

[Link]("D");

[Link]("Floap");

else{

[Link]("F");

[Link]("You are a losser + disaster");

AgeDemo:

package [Link];

import [Link];
public class AgeDemo {

public static void main(String[] args) {

Scanner input = new Scanner([Link]);

int ages;

[Link]("Enter your age: ");

ages = [Link]();

if(ages>=80){

[Link]("You don't have time: ");

else if(ages>=70){

[Link]("YOu have some time");

else if(ages>=60){

[Link]("You are a old man");

else if(ages>=40){

[Link]("Now you are a good father");

else if(ages>=30){

[Link]("Now you are young");

else if(ages>=15){
[Link]("YOu are a teenager");

else if(ages>=1){

[Link]("You are a child");

else{

[Link]("You are not born");

VowelConsonantDemo:

package [Link];

import [Link];

public class VowelConsonantDemo {

public static void main(String[] args) {

Scanner input = new Scanner([Link]);

char ch;

[Link]("Enter a letter: ");

ch = [Link]().charAt(0);
if(ch>='a'){

[Link]("Vowel");

else if(ch>='e'){

[Link]("Vowel");

else if(ch>='i'){

[Link]("Vowel");

else if(ch>='o'){

[Link]("Vowel");

else if(ch>='u'){

[Link]("Vowel");

else{

[Link]("Consonant");

You might also like