More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. OOPs or Object Oriented Programming is a Programming model which is organized around Objects instead of processes. Instead of a process calling series of processes, this model stresses on communication between objects. Objects that all self sustained, provide security by encapsulating it's members and providing abstracted interfaces over the functions it performs. OOP's facilitate the following features
1. Inheritance for Code Reuse
2. Abstraction for modularity, maintenance and agility
3. Encapsulation for security and protection
4. Polymorphism for flexibility and interfacing
Help us improve. Please let us know the company, where you were asked this question :
Ans. System is a class within java.lang package that contains several useful class fields and methods. It cannot be instantiated and hence can use only statically.even in this case this has been used statically i.e with class name itself and without creating an instance.
out is the static reference of Printstream declared as following in the System Class -
public final static PrintStream out = null;
println is the method of PrintStream class.
Help us improve. Please let us know the company, where you were asked this question :
Q8. Tell something about BufferedWriter ? What are flush() and close() used for ?
Ans. BufferedWriter is temporary source for data storage.BufferedWriter is used to write character data to the file.Flush() is method available in B.W which ensures that all data items are written to file including last character.Close() is used to closes the character output stream.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Scanner class introduced in Java 1.5 for reading Data Stream from the imput device. Previously we used to write code to read a input using DataInputStream. After reading the stream , we can convert into respective data type using in.next() as String ,in.nextInt() as integer, in.nextDouble() as Double etc
Help us improve. Please let us know the company, where you were asked this question :
Ans. Though there are many differences the way internally they both iterates the collections and streams respectively, but the main difference in performance that is achieved by spliterator as it can iterate Streams in Parallel whereas iterator only iterates collections sequentially.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Spliterator has better performance potential than iterators but only if the potential is used. Spliterator can iterate streams in parallel as well as in sequence whereas iterator can only iterate in sequence.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Spring Security is a powerful and highly customizable authentication and access control framework. It is the de facto standard for securing Spring-based applications.
Help us improve. Please let us know the company, where you were asked this question :
Ans. public class Class{
public static void main(String[] args){
List<Integer> collector = new ArrayList();
Scanner scanner = new Scanner(System.in);
int x = scanner.nextInt();
while(x != 0){
collector.add(x);
x = scanner.nextInt();
}
System.out.println(collector.stream().collect(Collectors.averagingInt(p->((Integer)p))));
}
}
Help us improve. Please let us know the company, where you were asked this question :
Ans. A gobbler class take care of reading from a stream and optionally write out to another stream. Allows for non blocking reads when invoking a process through Runtime.exec(). Moreover the user can specify a callback that is called whenever anything is read from the stream.
Help us improve. Please let us know the company, where you were asked this question :
Ans. A shard is a uniquely identified group of data records in a stream or we can say that Shard is a partition in Kinesis stream. A shard supports a fixed bandwidth i.e fixed number of messages per second. The total capacity of the stream is the sum of the capacities of its shards. If the data rate changes, we can allocate / deallocate more shards to accommodate that.
Help us improve. Please let us know the company, where you were asked this question :
Ans. streams are used for sequential processing of data and parallel streams are used for parallel processing of data (only if the underlying processor is multicore).
Help us improve. Please let us know the company, where you were asked this question :
Ans. We are averaging elements of a collection by element1 grouped by element1
* list is the reference of collection
* element1 is the member element returned by getElement1 method of ClassA
* element2 is the member element returned by getElement2 method of ClassA
Help us improve. Please let us know the company, where you were asked this question :
Ans. Map<DataType1,DataType2> where DataType1 is the data type of element1 ( returned by getelement1 method ) and DataType2 is the data type of element2 ( returned by getElement2 method )
Help us improve. Please let us know the company, where you were asked this question :
Ans. Which group of bytes represent which character is defined by character encoding. So when reading character by character from a stream of bytes using Reader, specifying character encoding becomes significant as the same group of bytes can represent different character in different character encoding(Eg UTF-8 and UTF-16 etc.)
Help us improve. Please let us know the company, where you were asked this question :