study java

Magic Number Program in Java

Magic number is the if the sum of its digits recursively are calculated till a single digit If the single digit is 1 then the number is a magic number. Magic number is very similar with Happy Number.

Prime Number Up to N Terms Program in Java

Prime Number Up to N Terms Program in Java. Ex: Enter size of prime=5
Number is prime=2
Number is prime=3
Number is prime=5
Number is prime=7
Number is prime=11
Number is prime=13

Mobike Program in Java

Define a class called Mobike with the following description:
Instance variables/data members:
String bno – to store the bike’s number(UP65AB1234)
String name – to store the name of the customer
int days – to store the number of days the bike is taken on rent
int charge – to calculate and store the rental charge
Member methods:
void input( ) – to input and store the detail of the customer.
void compute( ) – to compute the rental chargeThe rent for a mobike is charged on the following basis.
First five days Rs 500 per day;
Next five days Rs 400 per day
Rest of the days Rs 200 per day

void display ( ) – to display the details in the following format:
Bike No. PhoneNo. No. of days Charge

Object-Oriented Programming Concepts

If you’ve never used an object-oriented programming language before, you’ll need to learn a few basic concepts before you can begin writing any code. This lesson will introduce you to objects, classes, inheritance, interfaces, and packages. Each discussion focuses on how these concepts relate to the real world, while simultaneously providing an introduction to the syntax of the Java programming language.

Java Nested Class or Java Inner Classes

Objects that are instances of an inner class exist within an instance of the outer class.

Java Literals

Literals A constant value in Java is created by using a literal representation of it. For example, here are some literals: an integer literal 100 floating-point literal 98.6 character constant literal ‘X’ string literal “This is a test”. A literal can be used anywhere a value of its type is allowed.

Java Identifiers

In programming languages, identifiers are used for identification purpose. In Java, an identifier can be a class name, method name, variable name or a label. For example : public class Test { public static void main(String[] args) { int a = 20; } } In the above java code, we have 5 identifiers namely : […]

Java Lexical Issues or Java Lexeme or Java Tokens

Java Tokens are the smallest individual building block or smallest unit of a Java program; the Java compiler uses it for constructing expressions and statements. Java program is a collection of different types of tokens, comments, and white spaces.

Matrix Multiplication Program in Java

Matrix Multiplication Program in Java

Matrix Program in Java

Matrix Program in Java

1 2 3 4 5 6