Different Types of Keywords in Java

varma
Updated on 18-Feb-2020 11:33:18

2K+ Views

Following are the different types of keywords in java—Access modifiers − private, protected, public.Class, method, variable modifiers− abstract, class, extends, final, implements, interface, native, new, static, strictfp, synchronized, transient, volatile.Flow control− break, case, continue, default, do, else, for, if, instanceof, return, switch, while.Package control− import, package.Primitive types− boolean, byte, char, double, float, int, long, short.Error handling− assert, catch, finally, throw, throws, try.Enumeration− enum.Others− super, this, void.Unused− const, goto.

Add K to Each Element in a Python List of Integers

Disha Verma
Updated on 18-Feb-2020 11:31:07

1K+ Views

In this article, we will learn how to add a constant K value to each element in a Python list of integers. A list is a data type in Python that stores a sequence of items separated by commas, like this − List = [item1, item2, item3…] Suppose we have a list of integers called "a" and a constant value "k." We need to add this "k" to each item in the "a" list. For example − Input: a = [5, 10, 15, 20] k = 5 Output: #On adding 5 to each element of the ... Read More

Add One Python String to Another

Pradeep Elance
Updated on 18-Feb-2020 11:28:35

400 Views

By adding strings in python we just concatenate them to get a new string. This is useful in many scenarios like text analytics etc. Below are the two approaches we consider for this task.Using += OperatorThe + operator can be used for strings in a similar was as it is for numbers. The only difference being, in case of strings the concatenation happens and not a numeric addition.Example Live Demos1 = "What a beautiful " s2 = "flower " print("Given string s1 : " + str(s1)) print("Given string s2 : " + str(s2)) #Using += operator res1 = s1+s2 print("result ... Read More

Add List Elements with a Multi List Based on Index in Python

Pradeep Elance
Updated on 18-Feb-2020 11:24:15

613 Views

Lists can be nested. Which means we have smaller lists as elements inside a bigger list. In this article we solve the challenge of adding the elements of a simple list to the elements of a nested list. If the length of the lists are different then the length of the smaller list becomes the maximum length of the resulting list.Below are the various methods to accomplish this.Using for LoopIn this method, we take the length of the smaller list and loop through the elements of this list adding it to the elements of the bigger list. Here we use ... Read More

Add Leading Zeros to Python String

Pradeep Elance
Updated on 18-Feb-2020 11:22:50

648 Views

We may sometimes need to append zeros as string to various data elements in python. There may the reason for formatting and nice representation or there may be the reason for some calculations where these values will act as input. Below are the methods which we will use for this purpose.Using format()Here we take a DataFrame and apply the format function to the column wher we need to append the zeros as strings. The lambda method is used to apply the function repeatedly.Example Live Demoimport pandas as pd string = {'Column' : ['HOPE', 'FOR', 'THE', 'BEST']} dataframe=pd.DataFrame(string) print("given column is ") ... Read More

Difference Between Keywords and Reserved Words in Java

Prabhas
Updated on 18-Feb-2020 11:11:37

741 Views

KeywordsKeywords in Java convey a special meaning to the compiler therefore, these cannot be used as identifiers. Java provides a set of 50 keywords.abstractcontinuefornewswitchassertdefaultgotopackagesynchronizedbooleandoifprivatethisbreakdoubleimplementsprotectedthrowbyteelseimportpublicthrowscaseenuminstanceofreturntransientcatchextendsintshorttrycharfinallongstrictfpvolatileconstfloatnativesuperwhileReserved wordsAmong the list of key words list mentioned above the key words goto and const are currently not in use. They are reserved words (for the future use).

Environment Variables Needed to Run Java Programs

varma
Updated on 18-Feb-2020 11:03:23

1K+ Views

Before running Java programs on your machine you need to set two environment variables namely, PATH − The path environment variable is used to specify the set of directories which contains execution programs.When you try to execute a program from command line, the operating system searches for the specified program in the current directly, if available, executes it.In case the programs are not available in the current directory, operating system verifies in the set of directories specified in the ‘PATH’ environment variable.CLASSPATH − The classpath environment variable is used to specify the location of the classes and packages.When we try ... Read More

Generate and Use Javadoc in Eclipse

varun
Updated on 18-Feb-2020 10:57:46

13K+ Views

To generate Java docs for your project you need to write the required information about the field, method or class as./**    *    * The method prints a simple message on the Console.    * */Then to generate the document follow the steps given below −Step 1 − Open eclipse, select the option Project →Generate Javadoc.Step 2 − Select the javadoc.exe file from the bin folder of java installation directory, select the destination folder for the generated java doc and select Next.Step 3 − Type the title of the documentation in the Document title and select thefinish button.Step 4 ... Read More

What is a Java Class Library

vanithasree
Updated on 18-Feb-2020 10:50:13

1K+ Views

Java is not dependent on any specific operating system so Java applications cannot depend on the platform dependent native libraries, therefore, instead of those Java provides a set of dynamically loaded libraries that are common to modern operating systems.These libraries provide –Container classes and Regular Expressions.Interfaces for tasks that depend on the hardware of the OS such as network and file access.In case, the underlying platform does not support certain feature of Java then, these libraries surpass that specific feature if needed.

How Many Packages and Classes are in Java Standard Edition 8

usharani
Updated on 18-Feb-2020 10:48:17

1K+ Views

Java Standard Edition provides 14 packages namely –applet − This package provides classes and methods to create and communicate with the applets.awt− This package provides classes and methods to create user interfaces.beans− This package contains classes and methods to develop components based on java beans. io− This package contains classes and methods to read and write data standard input and output devices, streams and files.lang− This package contains the fundamental classes, methods, and, interfaces of Java language.math− This package contains classes and methods which helps you to perform arithmetic operations using the Java language.net− This package provides classes to implement networking ... Read More

Advertisements