multithreaded GroupChat using rmi with gui

So I have made a chat application with a single client and a server using RMI with GUI implemented. Now i want to create multiple clients that will ofcourse have multiple chat windows as well. But i’m having a problem here with for example, How do i connect the client to the server with a button click in the run() method. Or send messages to the server with a button click in the run() method.

The ChatSystemJFrame class below right now is for a single client, i want to change that to incorporate multiple clients. Please help and give some explanation as to how this can be resolved. Thank you.

If you want any further clarification, let me know :).

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

import javax.swing.JOptionPane;

import java.rmi.*;

/**
 *
 * @author Salman
 */
@SuppressWarnings("serial")
public class ChatSystemJFrame extends javax.swing.JFrame implements Runnable{

    /**
     * Creates new form CHatSystemJFrame
     */
    private ClientInt client;
    private Server server;

    public ChatSystemJFrame() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        jLabel1 = new javax.swing.JLabel();
        usernameField = new javax.swing.JTextField();
        connectButton = new javax.swing.JButton();
        disconnectButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        chatTextArea = new javax.swing.JTextArea();
        jScrollPane2 = new javax.swing.JScrollPane();
        onlineUsersArea = new javax.swing.JTextArea();
        jScrollPane3 = new javax.swing.JScrollPane();
        inputTextArea = new javax.swing.JTextArea();
        sendButton = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("Chat System"), this, org.jdesktop.beansbinding.BeanProperty.create("title"));
        bindingGroup.addBinding(binding);

        jLabel1.setText("Username:");

        usernameField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                usernameFieldActionPerformed(evt);
            }
        });

        connectButton.setText("Connect");

        connectButton.addActionListener(new java.awt.event.ActionListener(){
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                try {
                    if(connectButton.getText().toString().equals("Connect"))
                    {
                        doConnect();
                    }
                    else{
                        doDisconnect();
                    }
                } catch (RemoteException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (MalformedURLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (NotBoundException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        });

        disconnectButton.setText("Admin");

        chatTextArea.setEditable(false);
        chatTextArea.setColumns(20);
        chatTextArea.setLineWrap(true);
        chatTextArea.setRows(5);
        jScrollPane1.setViewportView(chatTextArea);

        onlineUsersArea.setEditable(false);
        onlineUsersArea.setColumns(20);
        onlineUsersArea.setRows(5);
        jScrollPane2.setViewportView(onlineUsersArea);

        inputTextArea.setColumns(20);
        inputTextArea.setRows(5);
        jScrollPane3.setViewportView(inputTextArea);

        sendButton.setText("Send");

        sendButton.addActionListener(new java.awt.event.ActionListener(){
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                try {
                    sendText();
                } catch (RemoteException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (MalformedURLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (NotBoundException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
        }
        });

        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("Online Users:");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(usernameField, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(connectButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(disconnectButton))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jScrollPane3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(sendButton, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 431, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 266, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(usernameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(connectButton)
                    .addComponent(disconnectButton)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 410, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addComponent(sendButton, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE))))
                .addGap(25, 25, 25))
        );

        bindingGroup.bind();

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public void setClientInt(ClientInt client)
    {
        this.client = client;
    }

    public void doDisconnect() throws RemoteException, MalformedURLException, NotBoundException
    {
        server.disconnect(client, usernameField.getText().toString());
        connectButton.setText("Connected");
        //usernameField.setEditable(true);
    }

    public void doConnect() throws RemoteException, MalformedURLException, NotBoundException
    {
        if(usernameField.getText().length() == 0)
        {
            return;
        }
        client = new ChatClient(usernameField.getText().toString(),this);
        Remote cs = Naming.lookup("rmi://localhost:6001/chatServer");
        server = (Server) cs;
        server.connect(client, usernameField.getText().toString());
        connectButton.setText("Disconnect");
        usernameField.setEditable(false);
    }

    public void sendText() throws RemoteException, MalformedURLException, NotBoundException
    {
        if(connectButton.getText() == "Connect")
        {
            JOptionPane.showMessageDialog(getContentPane(), "First you have to connect");
            return;
        }
        String textMessage = inputTextArea.getText().toString();
        inputTextArea.setText("");

        server.sendMessage(client, textMessage);
    }

    public void writeMsg(String message)
    {  
        chatTextArea.setText(chatTextArea.getText()+ "n" + usernameField.getText().toString()+ ": " + message);  
    }

    private void usernameFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usernameFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_usernameFieldActionPerformed

    public void run()
    {

    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ChatSystemJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ChatSystemJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ChatSystemJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ChatSystemJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run(){
                new ChatSystemJFrame().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextArea chatTextArea;
    private javax.swing.JButton connectButton;
    private javax.swing.JButton disconnectButton;
    private javax.swing.JTextArea inputTextArea;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTextArea onlineUsersArea;
    private javax.swing.JButton sendButton;
    private javax.swing.JTextField usernameField;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
}

public class Main {

    /**
     * @param args the command line arguments
     * @throws RemoteException 
     */
    public static void main(String[] args) throws RemoteException {
        // TODO code application logic here
        ClientInt client;
        ChatSystemJFrame chatSystemJFrame;

        for(int i = 0; i < 3; i++)
        {
            chatSystemJFrame = new ChatSystemJFrame();
            client = new ChatClient("",chatSystemJFrame);
            chatSystemJFrame.setClientInt(client);
            chatSystemJFrame.setVisible(true);
            Thread thread = new Thread(chatSystemJFrame);
            thread.start();

            //chatSystemJFrame(client).setVisible(true);
        }
    }

}

Dependency injected Bean object is null in Spring

I’m autowiring one of the dao class in my impl class as

@WebService
public class TransactionImpl implements Transaction{        

@Autowired
BBDao dao;

}

BBDao interface is as follows

public interface BBDao { /* Methods in it */ }

The implementation class which is implementing BBDao interface is

public class BBDaoImpl extends JdbcDaoSupport implements BBDao {    

@Autowired
ServletContext ctx; 

@Autowired
DataSource dataSource;

// Methods overriding here 

}

Servlet defined in web.xml

<servlet>
    <servlet-name>spring-web</servlet-name>
    <servlet-class>
                org.springframework.web.servlet.DispatcherServlet
            </servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>spring-web</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

And finally the spring-web-servlet.xml is

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.2.xsd">


<context:property-placeholder location="classpath:datasource-cfg.properties" />


<bean id="bbDAO" class="net.bb.dao.BBDaoImpl">
    <property name="dataSource" ref="dataSource" />
</bean> 

<!-- AS400 Data source Bean -->
<bean id="dataSource"
     class="org.springframework.jdbc.datasource.DriverManagerDataSource">

    <property name="driverClassName" value="com.ibm.as400.access.AS400JDBCDriver" />
    <property name="url" value="${as400.url}" />
    <property name="username" value="${as400.username}" />
    <property name="password" value="${as400.password}" />
</bean>

<mvc:annotation-driven />

</beans>

The BBDao bean object is coming as null.

Is there any mistake in my configuration? Any advice would be greatly appreciated.

java try to zip a folders

i have this code

https://docs.google.com/document/d/1CUbASiUPgu4N94OcMgZJqUz1wAyLX2ahaWym2IntLsA/edit?usp=sharing

and i want to zip a folders but i have some errors

Exception in thread "main" java.lang.NullPointerException
at general.ZipUtils.generateFileList(ZipUtils.java:82)
at general.ZipUtils.generateFileList(ZipUtils.java:83)
at general.ZipUtils.main(ZipUtils.java:29)

i don’t know how to solve it
thanks a lot for any help

Reading data from file in Java

I’m learning dynamicprogramming in Java, but I have a problem that the data must be read from file.However after reading data from file,the code isn’t work. Is there anyone know about this? Thanks, here my code. I compiled and ran it but it didn’t give the result.

 package longestcommonsubsequence;
import java.io.File;
import java.util.Scanner;
/**
 *
 * @author TGDD
 */

public class LongestCommonSubsequence
{

  /* Returns length of LCS for X[0..m-1], Y[0..n-1] */
  int lcs( char[] X, char[] Y, int m, int n )
  {
    int L[][] = new int[m+1][n+1];

    /* Following steps build L[m+1][n+1] in bottom up fashion. Note
         that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] */
    for (int i=0; i<=m; i++)
    {
      for (int j=0; j<=n; j++)
      {
        if (i == 0 || j == 0)
            L[i][j] = 0;
        else if (X[i-1] == Y[j-1])
            L[i][j] = L[i-1][j-1] + 1;
        else
            L[i][j] = max(L[i-1][j], L[i][j-1]);
      }
    }
  return L[m][n];
  }

  /* Utility function to get max of 2 integers */
  int max(int a, int b)
  {
    return (a > b)? a : b;
  }

  public static void main(String[] args)
  {
    LongestCommonSubsequence lcs = new LongestCommonSubsequence();
    File file = new File("output.text");
    try(Scanner sc = new Scanner(file)){
        String st1 = sc.nextLine();
        String st2 = sc.nextLine();

     char[] X=st1.toCharArray();
    char[] Y=st2.toCharArray();    
        int m = X.length;
    int n = Y.length;
     System.out.println("Length of LCS is" + " " + lcs.lcs( X, Y, m, n ) );
    }catch (Exception e ){}

Which Java EE server?

I’m moving in to developing Web Apps using Java EE and the first problem I have is not knowing which Server to use! There seems to be so many to chose from!

Glassfish server seems to stand out foremost (and it’s top of the list) but when I try to start Glassfish 4.1.2, I get the error GlassFish requires Java SE version 6. and I can’t download Java SE 6 for MacOSX without joining the “Oracle Club”.

So which Server should I use??

enter image description here

AsyncTask not create GridView using BaseAdpter

Im new to android development have very basic knowledge of this whatever i have achieved till now is achieved using this website or youtube videos i’m stuck in AsyncTask (Earlier i was using .get() on Create View and it was working fine but UI Was blocked until task is finished. To Avoid UI Blocking i was advice to remove .get() function from OnCreateView() function now after removing this im not being able to get any data from AsyncTask). I did that but now i’m not being able to create view i did lots of research but unable to get this strength

Here is my Codes Please Help how to create view from this

OnCreateView() :-

    public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
    View GView = inflater.inflate(R.layout.fragment_dashboard, container, false);
    progressBarHolder = (FrameLayout) GView.findViewById(R.id.progressBarHolder);
    GridView gridView = (GridView) GView.findViewById(R.id.gridView);
    //Toast.makeText(getActivity(),Json_String,Toast.LENGTH_LONG).show();
    String finalResult = null;
    try{
        finalResult = String.valueOf(new JSONTask().execute("https://www.example.in/android_api/dashboard_data",JsonData()));
        Toast.makeText(getActivity(),Json_String,Toast.LENGTH_LONG).show();
        JSONObject parentObject = null;
        parentObject = new JSONObject(finalResult);
        if(((String) parentObject.names().get(0)).matches("error")){
            JSONObject jObj = parentObject.getJSONObject("error");
            errorThrow(jObj.getString("Description"));
        } else if(((String) parentObject.names().get(0)).matches("success")){
            JSONObject jObj = parentObject.getJSONObject("success");
            JSONArray arrajson = jObj.getJSONArray("data");
            String arrayCount = Integer.toString(arrajson.length());
            String[] type = new String[arrajson.length()];
            Integer[] count = new Integer[arrajson.length()];
            for (int i=0; i<arrajson.length();i++){
                JSONObject jsonObject = arrajson.getJSONObject(i);
                type[i] = jsonObject.getString("type");
                count[i] = jsonObject.getInt("count");
            }
            CustomAdpter customAdpter = new CustomAdpter(DashboardFragment.this,type,count);
            gridView.setAdapter(customAdpter);
            return GView;
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return GView;
}

Base Adapter Code :-

    class CustomAdpter extends BaseAdapter {

    String[] type;
    Integer[] count;
    public CustomAdpter(DashboardFragment dashboardFragment, String[] type, Integer[] count){
        this.count = count;
        this.type = type;
    }
    @Override
    public int getCount() {
        return type.length;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view = getLayoutInflater().inflate(R.layout.grid_single_itme,null);
        TextView textView = (TextView) view.findViewById(R.id.TextView1);
        TextView textView1 = (TextView) view.findViewById(R.id.textView2);
        textView.setText(String.valueOf(count[i]));
        textView1.setText(type[i]);
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(getActivity(),"Booking Item Clicked",Toast.LENGTH_LONG).show();
            }
        });
        return view;
    }
}

AsyncTask Code :-

    public class JSONTask extends AsyncTask<String,String,String> {
    private ProgressDialog mProgressDialog;

    int progress;
    public JSONTask(){
        mProgressDialog = new ProgressDialog(getContext());
        mProgressDialog.setMax(100);
        mProgressDialog.setProgress(0);
    }

    @Override
    protected void onPreExecute(){
        mProgressDialog = ProgressDialog.show(getContext(),"Loading","Loading Data...",true,false);
        super.onPreExecute();
    }

    @Override
    protected String doInBackground(String... params) {
        HttpURLConnection connection = null;
        BufferedReader reader = null;
        final String finalJson = params[1];
        String json = finalJson;
        try{
            URL url = new URL(params[0]);
            connection = (HttpURLConnection) url.openConnection();
            connection.setConnectTimeout(5000);
            connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
            connection.setRequestProperty("A-APK-API", "******");
            connection.setRequestProperty("Authorization", "Basic **:**");
            connection.setDoOutput(true);
            connection.setDoInput(true);
            connection.setRequestMethod("POST");
            connection.connect();

            OutputStream stream = connection.getOutputStream();
            OutputStreamWriter streams =  new OutputStreamWriter(stream, "UTF-8");
            stream.write(json.getBytes("UTF-8"));
            stream.close();

            reader = new BufferedReader(new InputStreamReader(connection.getInputStream(),"UTF-8"));

            StringBuffer buffer = new StringBuffer();

            String line = "";
            while((line = reader.readLine()) != null){
                buffer.append(line);
            }
            return buffer.toString();

        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if(connection != null){
                connection.disconnect();
            }
            try {
                if(reader != null) {
                    reader.close();
                }
            } catch (IOException e){
                e.printStackTrace();
            }
        }
        return null;
    }
    protected void onPostExecute(String result){
        super.onPostExecute(result);
        Json_String = result;
        Toast.makeText(getContext(),result,Toast.LENGTH_LONG).show();
        mProgressDialog.dismiss();
    }
}

Please help me here

Paging results for the cache throws java.lang.Integer cannot be cast to java.lang.String

I use the method parameters as the redis cache key, the parameter type is Integer, when I test this method it throws Exception.The exception is java.lang.Integer cannot be cast to java.lang.String
This is my code:

@RequestMapping(value = "/queryNewsByPage", method = RequestMethod.POST)
@ResponseBody
@Cacheable( cacheNames="news", key = "#p0")
public Result queryNewsByPage(@RequestParam("currentPage") Integer currentPage) {
    PageUtil<News> pageUtil = newsService.queryNewsByPage(currentPage);
    return ResultUtil.successResult(pageUtil);
}

modified

@RequestMapping(value = "/queryNewsByPage", method = RequestMethod.POST)
@ResponseBody
@Cacheable( cacheNames="news", key = "#p0")
public Result queryNewsByPage(@RequestParam("currentPage") String currentPage) {
    Integer currentPage1 = Integer.valueOf(currentPage);
    PageUtil<News> pageUtil = newsService.queryNewsByPage(currentPage1);
    return ResultUtil.successResult(pageUtil);
}

It works.But I don’t know why.
Thanks

Create String from char Array List in java

I have multiple char array with different size
like:

char[] charArray1 ={ 'a', 'b', 'c'};
char[] charArray2 ={ 'x', 'y'};
...
..
.

Now I want to create all possible string combination from this two array

String length must be 2 as there are 2 array, If there are N array then String length must be N

Array Length may be any there is no restriction of array length

So for above two array, Strings should be like ax, ay, bx, by,….

Result strings should not be duplicate

Thanks