Set Printing Double-Sided Documents with CSS

Chandu yadav
Updated on 26-Jun-2020 07:07:38

596 Views

When printing double-sided documents, the page boxes on the left and right pages should be different.ExampleIt can be expressed through two CSS pseudo-classes as follows −    

Stack in Java

Samual Sam
Updated on 26-Jun-2020 07:05:40

2K+ Views

A stack class is provided by the Java collection framework and it implements the Stack data structure. The stack implements LIFO i.e. Last In First Out. This means that the elements pushed last are the ones that are popped first.The following are some of the methods.Sr.NoMethods & Description1boolean empty()Tests if this stack is empty. Returns true if the stack is empty, and returns false if the stack contains elements.2Object peek( )Returns the element on the top of the stack, but does not remove it.3Object pop( )Returns the element on the top of the stack, removing it in the process.4Object push(Object ... Read More

Permutation and Combination in Java

karthikeya Boyini
Updated on 26-Jun-2020 07:04:26

6K+ Views

Permutation and Combination are a part of Combinatorics. Permutation is the different arrangements that a set of elements can make if the elements are taken one at a time, some at a time or all at a time. Combination is is the different ways of selecting elements if the elements are taken one at a time, some at a time or all at a time.An example of this is given as follows −Permutation = factorial(n) / factorial(n-r); Combination = factorial(n) / (factorial(r) * factorial(n-r)); n = 5 r = 3 Permutation = 60 Combination = 10A program that demonstrates this ... Read More

Keywords in Java

Samual Sam
Updated on 26-Jun-2020 07:04:17

1K+ Views

Keywords in Java are reserved words that represent predefined actions, internal processes etc. Because of this, keywords cannot be used as names of variables, functions, objects etc.The main difference between keywords and identifiers is that keywords are reserved words that represent predefined actions while identifiers are the names of variables, functions, objects etc.Some of the keywords in the Java are given as follows −abstractassertbooleanbreakbytecasecatchcharclassconstcontinuedefaultdodoubleelseenumextendsfinalfinallyfloatforgotoifimplementsimportinstanceofintinterfacelongnativenewpackageprivateprotectedpublicreturnshortstaticstrictfpsuperswitchsynchronizedthisthrowthrowstransienttryvoidvolatilewhileA program that demonstrates keywords is given as follows −Example Live Demopublic class Example { public static void main(String[] args) { int i = 5; char c = 'A'; System.out.println("i = " + i); System.out.println("c = " + ... Read More

Different Methods to Find Prime Number in Java

Samual Sam
Updated on 26-Jun-2020 07:03:02

2K+ Views

A prime number is a number that is only divisible by one or itself. Some of the prime numbers are 2, 3, 5, 7, 11, 13 etc.Some of the different methods to find a prime number in Java are given as follows −Method 1 - Find if a number is prime without using a functionA program that finds if the given number is prime without using a function is given as follow −Example Live Demopublic class Example {    public static void main(String args[]) {       int num = 11, flag=0;       if(num == 0||num == 1) {          System.out.println( num + " is not a prime number");       } else {          for(int i = 2; i

Read and Write TAR Archive Files Using Python tarfile

George John
Updated on 26-Jun-2020 07:01:45

3K+ Views

The ‘tar’ utility was originally introduced for UNIX operating system. Its purpose is to collect multiple files in a single archive file often called tarball which makes it easy to distribute the files. Functions in tarfile module of Python’s standard library help in creating tar archives and extracting from the tarball as required. The archives can be constructed with gzip, bz2 and lzma compressions or without any compression at all.Main function defined in this module is main() using which writing to tar file or reading from it is accomplished.Open()This function returns a TarFile object corresponding to file name which is ... Read More

Compare Two Objects of Character Type in Java

karthikeya Boyini
Updated on 26-Jun-2020 06:59:37

799 Views

To compare two objects of Character type in Java, use the compareTo() method.Firstly, we have created two Character type.Character one = new Character('m'); Character two = new Character('k');Now, to compare them, we have used the compareTo() method.int res = one.compareTo(two);The following is the example that compares character objects.Example Live Demopublic class Demo {    public static void main(String []args) {       Character one = new Character('m');       Character two = new Character('k');       System.out.println("Character object 1: "+one);       System.out.println("Character object 2: "+two);       int res = one.compareTo(two);       if ... Read More

Display Thread's Information in Java

Krantik Chavan
Updated on 26-Jun-2020 06:55:04

4K+ Views

In order to get the name of the Thread, we use the getName() method in Java. This method returns the name of the thread.Declaration − The java.lang.Thread.getName() method is declared as follows −public String getName()In order to get the identity of the Thread, we use the getId() method in Java. This method returns the identifier of the thread. The thread ID is a positive long number produced during the creation of the thread.Declaration − The java.lang.Thread.getId() method is declared as follows −public long getId()In order to get the state of the Thread, we use the getState() method in Java. This ... Read More

Assertions in Java

Nancy Den
Updated on 26-Jun-2020 06:51:31

6K+ Views

An assertion is a statement in Java which ensures the correctness of any assumptions which have been done in the program. When an assertion is executed, it is assumed to be true. If the assertion is false, the JVM will throw an Assertion error. It finds it application primarily in the testing purposes. Assertion statements are used along with boolean expressions.Assertions in Java can be done with the help of the assert keyword. There are two ways in which an assert statement can be used.First Way −assert expression;Second Way −assert expression1 : expression2By default, assertions are disabled in Java. In ... Read More

Consumer Rights and Responsibilities

Shanmukh Pasumarthy
Updated on 26-Jun-2020 06:51:01

269 Views

Shopper rights are presently a vital part of our lives. They have been well framed and tremendously discussed. We have all made utilization of them eventually in our day to day activities. Market assets and impacts are developing every day and so is the familiarity with consumer rights. These rights are well characterized and there are agencies like the consumer courts and government offices that work towards shielding them.Keeping in mind the goal to protect consumer interest, six rights were put forth by consumer rights activists of the West, which are:Right to InformationRight to SafetyRight to ChoiceRight to be HeardThe ... Read More

Advertisements