Tumblr Jav

Tumblr Jav



🛑 👉🏻👉🏻👉🏻 INFORMATION AVAILABLE CLICK HERE👈🏻👈🏻👈🏻

































Tumblr Jav




Posts





Ask me anything





Archive




Have you ever wondered what does JAVA stands for? What is the full form? Who named it? Well, time to quell the anxieties. As per James Gosling, the story goes something like.
Initially the working title was named ‘Oak’, randomly on a oak tree outside the office. When it came to legalities, Trademark Lawyers found it infeasible. The product was ready. But now they were left without a name to package it.
Without time or resources to spend on naming the product, a naming consultant locked a dozen of the team members into a room and start asking questions, “How does this product makes you feel like?”. Obvious answer was excited!. Then the question, “What else makes you feel the same?” Coffee! Java! After a lot of questions and lots of answers, they prepared a list, which was send to the lawyers for vetting.
Initial names like 'Silk’ was rejected. The fourth on the list, 'Java’ was approved. The very next option and Gosling’s favourite was 'Lyric’. How would you have liked to work on LYRIC?
As per Gosling, he can’t be sure who shouted JAVA during the session, but his best guess is Mark Opperman.
AWS Lambda (Amazon Web Services Lambda) is a service that manages compute resources and runs the code within milliseconds of trigger. Say if someone uploads an image from an app. Applications running using AWS are able to run the code almost real time.
We can also create back-end services and trigger compute resources automatically (w/o direct user input). 
One has to pay as per the compute time and requests served. This sounds a good thing for small entities looking to build applications without provisioning infrastructure. For web/mobile applications handling huge traffic, AWS claims to process within milliseconds. 
You can try it put for free. AWAS Lambda offers 1,000,000 requests and upto 3.2 millions seconds for free. 
With the trust of Amazon, this seems to be an interesting option.
Best is that there is no need to buy custom hardware and keep it (even when it is idle). If you are starting up your startup, best is to take advantage of AWS Lambda. This is real time (almost) and highly cost effective.
Write the code and upload the code. Everything else is taken care of. It has fault-tolerant with multiple redundancies of data built-in. You can write your code in Java. 
Fork/Join framework is an implementation of ExecutorService. We have a ThreadPool. Tasks are allotted to the worker threads. The difference here is if some thread is free, it will steal the work from a busy thread, thereby maximizing performance.
ForkJoinPool is the implementation of ExecutorService which can run ForkJoinTasks. It is different from other ExecutorServices as the threads in the pool tries to steal the subtasks created by other Tasks (being processed by other threads). It’s like a workaholic employee who ends up doing other people’s work also. In effect it improves firms overall performance.
SumArray extends ForkJoinTask (RecursiveTask/RecursiveAction). See here the analogy with a simple ThreadPoolExecutor, which requires a Runnable/Callable task. The SumArray needs to have function compute() (analogous to run()) which will be called post pool.invoke() (analogous to execute()). Also a function invokeAll() is available to the SumArray, which is just like invoke, but takes multiple ForkJoinTasks and assign them to the ForkJoinPool.
Abstract class questions are generally asked for junior level interviews. 
And for higher level they are coupled with interfaces. Interfaces though considered an inferior sibling of interface, has a lot of aces up its sleeve when it comes to interviews.
Let’s have a look at what questions can crop up in interviews. See this post for Interface Interview Questions.
Abstract class contains either all abstract functions or a combination of abstract/concrete functions, or all abstract functions. A class extending the abstract class, need not to implement all the functions of the abstract class. An abstract class can have any type of variables.
Be sure to get this question for junior level interviews.
No an abstract class can’t be instantiated. We can only instantiate a subclass of the abstract class. Condition is that sub class should also not be abstract.
All interfaces are abstract interfaces. All methods are abstract (method signatures) in an interface.
Unlike Interfaces, Abstract class can have a constructor. To access the constructor, we have to first extend the abstract class. Then the subclass can be instantiated and the constructor will be called (if not overridden). 
In such a case, abstract class need not implement all methods of the interface as it is abstract. 7. What happens if we define abstract class as final? It’s not permitted in Java. A final class can’t be extended. That defeats the very purpose of abstract class. Abstract and Final are in fact opposites of each other. 8. Explain abstract method in Java. A method without a body and with abstract keyword is an abstract method. It doesn’t have a body just a declaration. Abstract class need to be extended and the method implemented. 9. What methods can be there inside abstract class? Abstract class can have both abstract and concrete methods. Not compulsory to have all methods abstract. 10. Can we have static method inside an abstract class? Theoretically yes, but in practice we should avoid it. As static method can’t be overridden in a subclass and also it is to be used directly with ClassName without instantiation. This defeats the purpose of the abstract class.



1 note



Jun 19th, 2015

Java Multi-Threading Interview Questions
When we can execute multiple computations in parallel, we call this as concurrency. Dictionary definition goes like existing, happening, or done at the same time.
We can either use multiple cores on the same machine or use multiple machines to achieve this. Think of it like, either one person uses both hands or 2 person using one hand each for some work. Either ways we get 2 working hands.
Thread relates to running of a program. A Thread is a single chain of execution within a program.
Read More on Threads: What is a Thread ?
a) Thread is like a sub-process. Multiple thread paths can exist within a single process.
b) All threads share the same resources (memory, variables) within a process. This can result into conflict, hence needs to be handles carefully.
c) Apart from shared resources, each thread has its own stack space where it stores variables local to it.
d) One can argue that we can create multiple processes, then why is the need for multiple threads. You can read about it here. Multiple threads v/s Multiple processes.
It’s quite straightforward an answer. What is advantages if we can use both hands simultaneously? We would able to finish ours tasks faster. Same is the case with multiple threads. They work in parallel and does not let single CPU to be idle. Also utilize multiple CPU’s efficiently. In a single process, threads share the heap memory, Hence we do not need to allocate separate Heap for different Threads. 
Thread is like a sub-process. Multiple threads occur within a single process and share the Heap Memory. 
Process is a single program. It spawns a single Heap. Thread is like a light process and requires less resources than a Process as they share the resources within a Process.
No. Java program is executed with the main Thread. So a Process needs at least One Thread to execute.
There are couple of ways for creating a Thread in Java (actually there are more ways than that, but ultimately it boils down to these two ways). Either extend Class java.lang.Thread or implement Interface java.lang.Runnable. 
There are two methods, start() and run(). 
start(): New Thread execution begins by start(). JVM in turn calls run() method.
run(): This should not be called directly if Thread Class is extended to create a Thread. This simply calls the run() method in the same thread and just executes the code in the same thread.
When we write a code and create a Thread (either by extending Thread or implementing Runnable), it is called User Thread. When the all user Thread ends in a process, the JVM exits.
A thread running in background and does not stop JVM from exiting is called Daemon Thread. A classic example is the Garbage Collector, which is started by JRE and runs in the background.
Runnable and Callable are two Interfaces, which we implement to create a Task which is executed in a separate Thread. run() method in Runnable, does not return anything. call() method in Callable can return a Future object as result or even throw an Exception.  
Yes, There is a Thread.currentThread() method for that very reason. 
The States of a Thread in Java are as follows:
RUNNABLE: Thread executing in JVM (might not execute in OS, as OS might make it wait for the processor, say)
WAITING: Waiting ad infinitum for some other thread to perform some action. If current Thread callsObject.wait(), it is WAITING for some other thread to call Object.notify().
BLOCKED: Waiting to get monitor lock
We have a char[] inside Thread class which stores name of the Thread. There is long Thread Id. They can be used to uniquely identify a Thread on the JVM.
Thread.sleep() is used for pausing the given Thread for a given time. Once the sleep time is over, Thread is scheduled and gets executed at next CPU cycle.
Threads can be assigned to a given java.lang.ThreadGroup. The Threads assigned to a particular Thread Group can be made to behave similarly. They can be interrupted together. Their priority can be changed together.
A Thread can hold another ThreadGroup also and form tree like structure. However it has become obsolete overtime and should be avoided.
Priority is defined as, the fact or condition of being regarded or treated as more important than others. Thread Class has an int member, priority. We can allocate a priority to a Thread from 1 to 10 (lower to higher priority). However which Thread will be executed first totally depends on Thread Scheduler of JVM. It can be that a higher priority Thread is the last one to be executed. Priorities are like an humble request to JVM. Whether it is accepted or rejected is totally JVM’s prerogative.
One important concept to be understood before moving forward is Context Switching. When multiple processes share a single CPU, they fight for the CPU time. It is via context switching that each of them gets some CPU time slice. In very basic terms, one process should be switched out of CPU so that another process can run. Similar context switching can be understood at the JVM level for a single process which has many threads.
Volatile variable guarantees to be in consistent state even without explicit synchronization. It promises that any write will happen before ant subsequent read. The read/write operation becomes atomic with volatile variables.
With the above definition in mind, we can visualize it’s use in multi-threaded code, where consistence of shared variables is mandatory. Thus volatile variable can be used for share data (there are some limits to it). 
This goes to the Operating System and you might have read it during OS course in College. Scheduler allocated CPU time-slices to Processes. Similarly Thread Scheduler allocated JVM time-slices to Threads. 
Time slicing is the process by which CPU time is allocated and divided among threads. The allocaion can be round robin, or based on priority of Thread etc.
Thread methods wait(), notify(), notify() are used to interact with each other about the status of the shared resource. 
Thread join is used to pause the current Thread till the specified Thread (on which we call join) is over. If join all threads inside main, then main will be last thread to finish. 
Thread-safe code means that the code will behave in a consistent manner when working with multiple threads. All read/writes will work as expected. A Class/Object can be thread-safe or not. Ex, Vector is thread-safe class. All methods take care that they don’t interfere with each others working. Don’t overlap and keeps the Vector values consistent.
No, A thread once started cannot be started again. If we try and invoke start() method twice, we get IllegalThreadStateException.
Daemon thread is a thread that runs in the background. It does not stop the JVM from terminating. We can write some sample code to mimic a daemon Thread as below. setDaemon(true) needs to be set.
24. Can we convert any user thread into daemon thread by setting setDaemon(true)? No, once a thread is started, it cannot be converted to Daemon Thread. If we try and call setDaemon(true) on an already running Thread, we get IllegalThreadStateException.
It is a common question in interviews. On the face of it, it seems to make more sense that wait(), notify() and notifyAll() are there in Thread. But they aren’t. An Object is used as a monitor in Java, which can span across Threads. Threads need something to communicate with each other. Object monitor is that something. Now if you think, keeping these methods in Threads does not make that much sense.
When different Threads race to get lock on the same Object, we call it Race condition. Suppose we want that Thread1 executes first and Thread2 executes after that. But when both Thread1 and Thread2 wants to get lock on the Monitor, and Thread2 gets lock first. This will result in an unexpected result as now Thread2 will be executed first and Thead1 after that.
Since these methods works on the current thread, hence there is no need to invoke them on other thread Objects from within another thread. Making them static means there is no scope of confusion in this regard. 
When a Thread waits(), it waits on something. That something is the Monitor. That lock is taken by synchronized keyword. Then a Thread can wait() or notify() about the lock status of that Monitor. Hence we need to call them from inside synchronized block/method. If we don’t do that code will throw IllegalMonitorStateException.
If the exception is not handled by try-catch inside the run() method, the thread will be stopped by JVM. So we need to handle the exceptions and write a good exception Handler. One such handler is UncaughtExceptionHandler, which can be registered with the Thread. In case of any Exception now, JVM knows to use the Handler registered.
Synchronized Block is better as it takes the lock only for the short time and limited scope. Synchronized method() takes lock on the Object for the entire method execution.
We can use synchronization, atomic classes, volatile keyword, immutable classes, using Lock interface. Java also provides custom Thread safe classes also to be used.
32. Explain the concept of busy waiting.
Busy waiting, as the name suggests occurs when a Thread does some work while it keep occupying the processor. That active work is required to arrive at the decision if the Thread can relinquish the CPU. Check the sample code below:
CountDownLatch become unusable once count reaches zero. However CyclicBarrier can be reused even after barrier is broken.
SumArray extends ForkJoinTask (RecursiveTask/RecursiveAction). See here the analogy with a simple ThreadPoolExecutor, which requires a Runnable/Callable task. The SumArray needs to have function compute() (analogous to run()) which will be called post pool.invoke() (analogous to execute()). Also a function invokeAll() is available to the SumArray, which is just like invoke, but takes multiple ForkJoinTasks and assign them to the ForkJoinPool.



1 note



Jun 18th, 2015

One important concept to be understood before moving forward is Context Switching. 
When multiple processes share a single CPU, they fight for the CPU time. It is via context switching that each of them gets some CPU time slice. 
In very basic terms, one process should be switched out of CPU so that another process can run. 
Similar context switching can be understood at the JVM level for a single process which has many threads.



1 note



Jun 17th, 2015

What happens when  Thread.sleep(TIMEOUT)  is called? TIME-SYNCHRONIZATION
The running Thread is forcefully switched out ( context switching ) and put in  TIMED_WAITING  state for the specified interval.
As name suggests, it simply sleeps and  require no CPU time-slice . Theoretically speaking, if this is the only process running and you put Sleep statements with substantial TIMEOUT, you will notice drop in CPU usage. Short bursts of continuous sleep statements, might increase CPU usage as Context Switching incurs its own cost.
Once the Sleep time is over, Thread is scheduled back to be executed. However there is no guarantee that  Context Switching will happen immediately. Depends upon the resources available. If a high priority work is going on, this Thread will not get CPU time instantaneously. If will be scheduled no doubt, but when it will be executed comes with no guarantee.
Sleep can be interrupted by Thread.interrupt(). This caused InterruptedException to be thrown. It is normally used to HALT the operations.
If sleep is called from a synchronized block (say). No other Thread can enter this block. Thread  holds the ownership (lock) of the monitor  object.
sleep is a static method. If we call diffThread.sleep from the current Thread, it wont halt diffThread. It is the current Thread which will sleep.
What happens when  Object.wait()  is called from inside the synchronized block? MULTI-THREAD SYNCHRONIZATION
The running Thread is switched out ( context switching ) and goes to the  WAITING  state .  In WAITING state, it requires no CPU time-slice.
The Thread will  hold no lock on the monitor  object. Any other thread can enter the synchronized block.
It will remain in WAITING state until some other Thread which will synchronize on the same object, calls Object.notify()
Once  Object.notify()  is called, of all Threads that are WAITING on the same monitor object, one is awakened at random and is  moved to BLOCKED  state (Moved from waiting queue of object to entry queue of the object), where it tries to get the lock on monitor object. It has to fight with other Threads BLOCKED on the same Object. Once it gets the lock, it is scheduled to be executed by the CPU, again with no guarantees when.
If 10 Threads have called Object.wait() on the same object, Object.notifyAll(), awakens all 10 threads and move them in BLOCKED state where they fight with other BLOCKED Threads for the lock on the object  One of these 10 might get the lock (some other Thread which was BLOCKED to enter the  synchronized block, might just get the lock) and rest 9 go back to the WAITING state (in effect waiting Queue of the Object) till they get the next notify signal.
In BLOCKED state Thread incurs CPU cost as it tries to get the lock. JVM might try to get to acquire monitor lock multiple times before context switching it OR JVM might context switch it just after one try. It depends on Algorithm implemented at JVM level.
Interface questions are asked mostly in mid level to senior level interviews (3-8 yrs), with increasing complexity. Given that interfaces are base of most applications which help the code loosely couple and modular. This doesn’t come as a surprise. 
In the projects that I have worked, Interface was the starting point of our design and the whole code was written on top of those interfaces, making code loosely coupled, scalable and easy to manage.
Patterns based on interface (Factory/Abstract Factory) are another hit among the interviewers. So is the difference and usage of abstract class and interface. Let’s go through expected questions one by one. 
Interface is a defined just like a class. Only that the methods are defined but not implemented. As for the member variable, interface can declare constants. A class that implements and interface has to implement all the methods of an interface. It forms a ‘like-a’ relationship.
Without much information about the problem, it is difficult to answer. But interface should be the preferred thing. As a class can only extent 1 abstract class, but implement multiple interfaces. This makes the code flexible.
It’s not as straightforward as writing a new function. Since all the classes that are implementing the interface will break unless they all implement the interface (be it empty implementation). Hence interfaces should be designed properly at the very beginning. Later on we have to more or less stick with what we have. 
We can theoretically do it and implement the function in all classes that have already implement the interface. But it is avoidable.
Be sure to get this question for junior level interviews.
As we read, it’s not feasible to add a method to an interface later on but can be added to an abstract class without issues. Hence interface should be avoided in cases where we want an evolving code. Also in situations when we have a lot of methods inside an interface, it becomes a pain to implement each one. We should prefer abstract class in such cases.
In such a case, abstract class need not implement all methods of the interface as it is abstract.
No interface can’t have a constructor.
List Interface provides ordered collection, We can add/get values using index.
Map maps keys to values. Duplicate keys are not allowed.
A lot of implementation of List and Map are provided with Java.
1. A common logging system for all JVM components.
2. Javac annotations pipeline to be redesigned.
3. Better the contended Java Monitors. Faster Notify/NotifyAll/Monitor exit.
4. Capability to validate JVM input command line flat arguments.
5. Remove mJRE feature which helped selection of JRE at runtime.
6. Applications running with Security Manager to be improved in performance.
There is  a long list of features apart from the above mentioned. Read here More about Java 9 . 

GitHub - tumblr /jumblr: Tumblr API v2 Java Client
Java Interview Questions
Watch JAV Teen HD Free - Free JAV Uncensored - JAV Streaming...
adarutoeiga.com - JAV Watch Online, JAV Tube, JAV Film & JAV Free Download
Is there a decent Java client for the Tumblr ... - Stack Overflow

Доверие
Нет


Недавние публикации: Sur.ly for Wordpress

Teen Amature Boobs
Beautiful Fit Women Nude
Women Working Out In The Nude
Sexy Latinas Bodies
Superhero Porn Pictures

Report Page