Home Answers Viewqa Java-Interview-Questions How I call the function union from the main

 
 


Fathi
How I call the function union from the main
0 Answer(s)      3 years and a month ago
Posted in : Java Interview Questions

Please, from
public static void main(String[] args)

I would like to call the function union and I have to pass to the functions two parameters, means two matrix mat1 and mat2 declared in main function


//-------------------------------

package model;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;

public class Relation
{
public boolean[][] matrix;
private boolean[][] matrix2;
int rows;
int columns;

public Relation(int rows, int columns)
{
this.rows = rows;
this.columns = columns;

System.out.println("Relation Called");

matrix = new boolean[rows][columns];
matrix2 = new boolean[rows][columns];

}


public Relation union(Relation mat)
{
boolean[][] m, p;
m = mat.getMatrix();
Relation result = new Relation(mat.rows, mat.columns);

p = result.getMatrix();

for (int i = 0; i < rows; i++)
{
for (int j = 0; j < columns; j++)
{
if ((matrix[i][j]) || (m[i][j]))
{
p[i][j] = true;
}
}
}
return result;
}

public Relation inverse()
{
boolean[][] m;
m = new boolean[columns][rows];
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < columns; j++)
{
m[j][i] = matrix[i][j];
}
}
Relation mat = new Relation(columns, rows);
mat.setMatrix(m);
return mat;
}



public static void main(String[] args)
{
Relation relation = new Relation(3, 4);

System.out.print("Give your name: ");

int[][] mat1 = { {1,0,0,0,0},
{0,1,0,0,0},
{0,0,1,0,0},
{0,0,0,1,0},
{0,0,1,0,1},

int[][] mat2 = { {1,1,0,1,0},
{0,1,0,0,1},
{0,0,1,1,0},
{0,0,0,1,0},
{0,0,1,0,1},

};

//calling the function union : paramtere to pass is mat
//how i call it
}
}
View Answers









Related Pages:
How I call the function union from the main - Java Interview Questions
How I call the function union from the main  Please, from public static void main(String[] args) I would like to call the function union and I...}, }; //calling the function union : paramtere to pass is mat //how i call
union
union  how to declare union function define in single line in java(eg:like c=a+b
call a function - Java Interview Questions
call a function  Please i want to call the function union via main How I can do it??? Here you find my code With my best Regards...}, }; //calling the function union : paramtere to pass is mat //how i
UIWebView call javascript function
UIWebView call javascript function  Hi, I am developing web browser for iPhone and iPhone devices. I want to call the java script in my html page from UIWebView. Please let's know how to call JavaScript function from objective c
how to call the array variable in scriptlet from javascript function
how to call the array variable in scriptlet from javascript function  ...","Porsche","Jaguar"}; %> Actually i want the array variable one by one and display them in the dropdown list by using the below function function myFunction
merge tables in sql using union
in database by merging two tables using union function in SQL?   REATE TABLE new_table SELECT * FROM table1 UNION SELECT * FROM table2;   CREATE TABLE new_table SELECT * FROM table1 UNION SELECT * FROM table2
php function call
php function call  I have an function in error-status.php like this function validateHostName($hostName) { if((strpbrk($hostName,'`~!@#$^&... to cal this function in my other page which is datetime.php how it is posible
how to call jsp from flex
how to call jsp from flex  hi, i want to know that how can i call a FLEX from JSP. . A good Example will be appreciated
How to call the run method from another class?
How to call the run method from another class?  Sorry, if this is a stupid question. I would like to find out how to call the run method... want to call this from AdaugaComanda.java, so that changes can be seen
how to call jsp from flex
how to call jsp from flex  Plz help me out to get JSP from FLEX.... I need your help.... Thanks for future
SQL Union with order by
SQL Union with order by  I want to combine three queries using union... am combine the three queries using union (SELECT * from userprojects where status='O' order by id desc) union all (select * from userprojects where status!='F
problem with main - Java Beginners
_DEGREES_SHOWN); } } i have copied this code from a book and i have a problem. when i compile it appears this message: java.lang.NoSuchMethodError: main Exception in thread "main" . Should i put a main in another file? And how can
call to a member function
call to a member function  While uploading the data on server i am getting following error... call to a member function children
call from java - JavaMail
call from java  Hi, how i will call servlet from java.. plz its urgent.. Thanks Narendra  Hi Narendra, You can use the java.net package to call a servlet from the java code
What is Public static void main
it. Static: main method is static because jvm will call it without creating object...What is Public static void main In most of the Programming language, main function is the first function where program start execution. This is the first
how to call from pc to telephone in java - MobileApplications
how to call from pc to telephone in java  Hi, presently I am working on "make a call from pc to telephone" in java. I am unable to procceed how to start. I am new this technoloy.Please give me some valuable suggestions how
iPhone Make Call from App
iPhone Make Call from App  iPhone Make Call Programmatically I have created an application in iPhone that has the functionality to make Call from App. I am just wondering how to make a call programmatically... is there any
Call an array from multiple functions
Call an array from multiple functions  I am having two methods in this method i am getting array values from another class. i create same array name...(array) that is the function i called second one is access and also
Hooking into the shutdown call - tutorial
into the shutdown call Last year, while I was trying out the jBoss EJB application...Hooking into the shutdown call 2001-02-28 The Java Specialists' Newsletter [Issue 011] - Hooking into the shutdown call Author: Dr. Heinz M. Kabutz
How i write a function/method in jsp?
How i write a function/method in jsp?  How write the function/method in jsp? Using that method i can retrieve the value coming from database. give.... And the details come from different table and id is store in user table. I hope you all
function call in javascript - Java Beginners
function call in javascript  hi all, i've written a javascript , but i m unable to call a function getExpression.i dont know why getExpression function is not being called. heres my code : function
how do i make a phone call from my app without quitting my application
how do i make a phone call from my app without quitting my application  hi, I am working on creating a call application, i am making a call from my... quits , i want my application to go to background and resume on call end ...please
Invoke JavaScript function from servlet
Invoke JavaScript function from servlet You have learnt several servlet related examples. Here we are going to create an example that will call JavaScript function from the servlet. Embedding JavaScript in Servlets can be useful when
VoIP Call
testing and passive monitoring from call quality pioneers Psytechnics... is something I get asked about all the time. I can't tell you how many times I... VoIP Call VoIP Call quality Network testing and monitoring
unoin function
unoin function  how to define a union function in java?(ex:a=a U b) how to write tha java code?give ex.   Java Union Function You have learnt union, intersection etc in Sets. Here the given code finds the union of two
how to pass variable from simple java main class(not servlet) to the jsp page?
how to pass variable from simple java main class(not servlet) to the jsp page?  I have a simple Java class in which I invoke a call to a JSP page... from the simple Java class to the JSP page. How can I do that? Here is my
JavaScript array union
JavaScript array union       In this Tutorial we want to show you an example from array union in Java Script. The code contain a script that include a variable arr1
main function
main function  Give me the description of public static void main(Strings args
Call dll from java - JSP-Servlet
Call dll from java  Any one tell me how to call dll from java. Basically , i want read the cash m/c parameters(4,i.e i want to read the cash count) in java .For this i want to call a dll from java . Also any one have
How to call jasper from jsp or servlet - JSP-Servlet
How to call jasper from jsp or servlet  Hi Expert , I created jasper report using ireport.how to call that jasper with jsp file or servlet file ? Thanks in advance Eswaramoorthy.s
cant call cmd from java - Java Beginners
cant call cmd from java   How can I call this from java to be executed by cmd ? ConvertXLS.EXE /S "C:\Extracto\*.CSV"/T "C:\Extracto\*.XLS" /C-4143 /F6 /M2 /R /V
call frame again - Java Beginners
call frame again  d, thank's for your answer, but i can't combine to my script. I will give you a complete code and please check this. the program... read from jbutton1 in FrameA to FrameB,then i write "JAVA" in Jtextfield1(FrameB
how to write function of copy from one to another location in this code
how to write function of copy from one to another location in this code  I need to write a code to copy a file from one location to another using browse button in it. i have written code for the browse button. please help me
SQL UNION Operator
column_name(s) FROM table_name1 UNION SELECT column_name(s) FROM table_name2... records from both the tables. The UNION operator only works with select.... SELECT * FROM Stu_Class_10 UNION SELECT * FROM Stu_Class_12
how to call java script function through java class file
how to call java script function through java class file  how to call jframe in java script
how to call servlet from html page at anchor tag ?
how to call servlet from html page at anchor tag ?  I have a very different problem as i am using netbeans ide 6.9 ml to make a website in java... it is not working properly. I split and merge template. In the header part of my page i use
Main function parameter in C language - Ajax
Main function parameter in C language  Please let me know how this Main(int argc,char*argv[]) works and detailed example on their roles in command...; Hi Friend, int main(int argc, char **argv) The main function serves
HIbernate call for sequence - Hibernate
HIbernate call for sequence  I have created a sequence in oracle table. Now how to access this in java class through hibernate from dual table i am..._S is this the right way to retrive the next value from
Call servlet from javascript - JSP-Servlet
Call servlet from javascript  Hi in my application i have jsp... screen when the user clicks submit button i have to pass this column values from...="+finaldate; FAForm1.reset(); } how do i implement this using jquery where my
PHP Function
and put the necessary coding into it and we can call this function from anywhere... manageable, robust. A general format of the function in PHP is as follows: function <function name> (<list of parameters>) With the help
how to solve the nullPointer Exception in main - Java Beginners
how to solve the nullPointer Exception in main  New to Java ,pls help me how fix Null pointer Exception in main: two files , split .java another is actualState1.java , I want to get value of spaceWord[1] from split.java
getting null value in action from ajax call
getting null value in action from ajax call  Getting null value from ajax call in action (FirstList.java)... first list is loading correctly. Need help, i am new to struts2 and hibernate. StudentRegistration.jsp <%@ page
getting null value in action from ajax call
getting null value in action from ajax call  Getting null value from ajax call in action (FirstList.java)... first list is loading correctly. Need help, i am new to struts2 and hibernate. StudentRegistration.jsp <%@ page
getting null value in action from ajax call
getting null value in action from ajax call  Getting null value from ajax call in action (FirstList.java)... first list is loading correctly. Need help, i am new to struts2 and hibernate. StudentRegistration.jsp <%@ page
Diff ways to call a EJB from Servlet, JSP - Java Interview Questions
Diff ways to call a EJB from Servlet, JSP  How can I call EJB from Servlet or JSP
how to make paging with function ?
how to make paging with function ?  how to make paging with function... "); //this page in only function call and next page in function body paging($offset...("SELECT * FROM login LIMIT $offset, $rowsPerPage"); echo " id first name last
call frame - Java Beginners
call frame   dear java, I want to ask something about call frame to another frame and back to first frame. I have FrameA and FrameB. In frameA... and Button to send data to JTextfield1 in FrameA. First i run FrameA, click button
how to call static method
how to call static method  class A { //some code } class B extends class A { static method() } class C { } //how to access static method() from B to C
how to call static method
how to call static method  class A { //some code } class B extends class A { static method() } class C { } //how to access static method() from B to C
how to call static method
how to call static method  class A { //some code } class B extends class A { static method() } class C { } //how to access static method() from B to C