What is Composition in Java

Lakshmi Srinivas
Updated on 30-Jul-2019 22:30:20

355 Views

The composition is also a type of aggregation where the relationship is restrictive i.e. If two objects are in composition, the composed object will not exist without the other.

Import Python Modules in Jython

Rajendra Dharmkar
Updated on 30-Jul-2019 22:30:20

1K+ Views

You can use pure python modules from jython. You can't use modules that are implemented in C. To use modules from your pip installs, you need to add the sys.path of python to that of Jython as Jython does not automatically pick up the PYTHONPATH informationJython 2.5 introduced the JYTHONPATH environmental variable as Jython-equivalent of PYTHONPATH, so setting both to the same value should do the trick for most use cases (unless you're working in a setup with incompatible Python an Jython versions).Now you can import python modules installed locally directly using 'import' in Jython.

Create String from Java ArrayList

George John
Updated on 30-Jul-2019 22:30:20

14K+ Views

To convert the contents of an ArrayList to a String, create a StringBuffer object append the contents of the ArrayList to it, finally convert the StringBuffer object to String using the toString() method. Example import java.util.ArrayList; public class String_ArrayList { public static void main(String args[]) { ArrayList al = new ArrayList(); al.add("Hello"); al.add("are"); al.add("you"); StringBuffer sb = new StringBuffer(); for (String s : al) { sb.append(s); sb.append(" "); } String str = sb.toString(); System.out.println(str); } } Output Hello are you

When to Use Document Ready and When Window Load in jQuery

Alex Onsman
Updated on 30-Jul-2019 22:30:20

868 Views

$(window).load()Use $(window).load(), when you want the code inside it to run only once the entire page is ready (not only DOM).  It executes when the page is fully loaded, including frames, objects and imagesNote: The load() method deprecated in jQuery version 1.8. It was completely removed in version 3.0. To see its working, add jQuery version for CDN before 3.0.$(document).ready()Use the  $(document).ready() method when you want the code inside it to run once the page DOM is ready to execute JavaScript code.

Best IDEs for Java Besides Eclipse

varma
Updated on 30-Jul-2019 22:30:20

298 Views

IntelliJ and NetBeans are the alternative IDE’s for Java development.

Schedule Script in PowerShell from SAP

vanithasree
Updated on 30-Jul-2019 22:30:20

234 Views

I had experienced a similar issue and it was because the scheduler did not have permissions of the file. The scheduler is unable to read the contents basically the login credentials from the file.As a work around what I did was I created a separate job altogether to capture the password in the form of a secure string and then ran the job with the service Id. In this manner, the service has required access of password.And just because it is the Id which is responsible for executing the job, it always ran well.

Determine the OS Running on a Computer Using Java

Sreemaha
Updated on 30-Jul-2019 22:30:20

161 Views

The System class of java.lang package provides a method named getProperty() this method accepts one of the following string parameters an returns the respective property. java.class.path − If you pass this value as a parameter, the getProperty() method returns the current classpath. java.home − If you pass this value as a parameter, the getProperty() method returns the current Installation directory of the JRE. java.vendor − If you pass this value as a parameter, the getProperty() method returns the current vendor name of the JRE. java.vendor.url − If you pass this value as a parameter, the getProperty() method returns the ... Read More

Print New Line in Java

Sai Subramanyam
Updated on 30-Jul-2019 22:30:20

2K+ Views

The java.io.PrintStream.println() method prints an array of characters and then terminate the line. This method behaves as though it invokes print(char[]) and then println(). Using this method you can print the data on the console. import java.io.*; public class PrintStreamDemo { public static void main(String[] args) { char[] c = {'a', 'b', 'c'}; // create print stream object PrintStream ps = new PrintStream(System.out); // print an array and change line ps.println(c); ps.print("New Line"); // flush the stream ps.flush(); } } Output abc New Line

Execute Static Block Without Main Method in Java

Samual Sam
Updated on 30-Jul-2019 22:30:20

2K+ Views

VM first looks for the main method (at least the latest versions) and then, starts executing the program including static block. Therefore, you cannot execute a static block without main method. Example public class Sample { static { System.out.println("Hello how are you"); } } Since the above program doesn’t have a main method, If you compile and execute it you will get an error message. C:\Sample>javac StaticBlockExample.java C:\Sample>java StaticBlockExample Error: Main method not found in class StaticBlockExample, please define the main method as: public static ... Read More

Use IFrame and Read Cookie in ABAP

seetha
Updated on 30-Jul-2019 22:30:20

244 Views

I think it is possible and can be simply achieved. You can do the following:Firstly, create a business server pages application on the server. Make sure the application contains a frameset and two IFrames as a part of the frameset.Then you need to split up the implementation between these two IFrames. First IFrame will contain the third party component and second component will contain the view and JS part of the application that we just created. Make sure the second frame does not have any height as it should be invisible to the user.Then you can write client-side code in ... Read More

Advertisements