Java Tutorial

by Dinesh Thakur Category: Data Type

This Swap Numbers Without Using Third Variable Java Example shows how to exchange numbers without using third variable using java. i.e. if the input is n1 100 and n2 200 then after swaping output will be n1 is 200 and n2 is 100. You should not use any temporary variable to swap the numbers.



 
by Dinesh Thakur Category: Data Type

When the block is declared without using any modifier, then it is treated as the non-static block is first executed before the constructor is executed. Non-static block directly access the static variable and instance variable.

 
by Dinesh Thakur Category: Data Type

The static modifier is associated only with methods and variables, not classes. The static modifier is used to specify variables that can only be declared once. Static methods are used to specify methods that should not be overridden in subclasses.

 
by Dinesh Thakur Category: Data Type

Java's built-in data types called primitive data types. The primitive data types are int, byte, short, long, float, double, char, and boolean. A variable of any of these data types is called a primitive variable. We explain primitive data types in more detail as follows:



 
by Dinesh Thakur Category: Data Type

This Convert int to string java example shows how to convert int to String in Java.



 
by Dinesh Thakur Category: Data Type

This Reverse Number using Java program prints reverse number using numeric operations i.e. if the input is 564 then output will be 465. we can see after reversing the integer is print the integer digits in reverse order.

 
by Dinesh Thakur Category: Data Type

This Swap Numbers Java Example program prints exchange number i.e. if the input is n1 is 100 and n2 is 200 then after swaping output will be n1 is 200 and n2 is 100. You should use any temporary variable to swap the numbers.

 
by Dinesh Thakur Category: Data Type

This JavaInterfaceExample shows, An interface is a blueprint of a class. its functions should be public and abstract. We use the interface Keyword to define an interface. if a class implementing an interface should use the implements keyword as we see in our example class JavaInterface implements InterfaceExample . No need to creating objects for an interface. Interfaces don't have constructors as they can't be initiated. An Interface can be extends by one or more interfaces.

 
by Dinesh Thakur Category: Data Type

This Java byte Example shows how to use Java primitive byte variable inside a java class. The byte is a 8 bit signed type ranges from –128 to 127. The syntex For Declare byte varibale is byte <variable name> = <default value>;



 
by Dinesh Thakur Category: Data Type

Static are the members or variables which are defined independently of any object of that class. Static members are the members that can be used by itself, without reference to a specific instance. We can declare both methods and variables to be static. The variables declared as static are global variables. When objects of the class are declared, no copy of a static variable is made. Instead, all instances of the class share the same static variable.

 
About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content