How I call the function union from the main

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 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 Tutorials/Questions & Answers:
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
how to call javascript function from flex
how to call javascript function from flex  how to call javascript function from flex
Advertisements
how to open one Jframe from main method call
how to open one Jframe from main method call  I have downloaded... the main() method, when i run this Engine.java class game starts running... don't want in my project Here is the code that i have included in main method
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
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
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 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
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
main function
main function  Give me the description of public static void main(Strings args
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
union
union  how to declare union function define in single line in java(eg:like c=a+b
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
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 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 java script function through java class file
how to call java script function through java class file  how to call jframe in java script
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
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
How to make phone call from web application
How to make phone call from web application  I'm creating an XHTML... to make call to a specific number when user clicks a particular button. Please suggest on how to do this. I'm new to this. Thanks in advance
call function in php
call function in php  What is the call function in PHP please explain
php function call
php function call  I have an function in error-status.php like this function validateHostName($hostName) { if((strpbrk($hostName,'`[email protected]#$^&... to cal this function in my other page which is datetime.php how it is posible
Main function.. - Java Beginners
Main function..  Hi Friend.. public static void main(String args[]) What does it mean...public - static - void - main -(String args[]) Can u plz... return the value when it exits main(): This is the entry point for the application
How can I call a Servlet that is declare on web.xml with spring framework
How can I call a Servlet that is declare on web.xml with spring framework  here is my problem, I have spring framework and Crystal Report... is declare on web.xml, but the spring dispacher don't find it so how I can make
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 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
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
how to call an exe file from java - Java Beginners
how to call an exe file from java  hi, how to call exe file with some parameters from java and save the output of the exe file in a specified path. Please let me know immediately..its urgent!!! Thanks in advance
how I do select from select in hql
how I do select from select in hql  select RN from ( select rownum RN, dbid from ( select * from profile p where type = 1912 and name like... doesn't work select RN from ( select rownum RN, DBId from ( select distinct p
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
main function in java - Java Interview Questions
main function in java  1....why is function main() define as static in java? 2...drawbacks of using rmi
how i get experience wise resume from database when i submit from browser
how i get experience wise resume from database when i submit from browser  how i get experience wise resume from database when i submit from browser   Please go through the following link: Visit Here
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
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
Calling Flex Function From JavaScript
From JavaScript Sometimes, you may need to call flex function from JavaScript... function callable from javascript. ExternalInterface.addCallback... by JavaScript to call the flex function, and the second parameter is the actual
How I get a variable from java script to use it in the scriptlet of jsp.
How I get a variable from java script to use it in the scriptlet of jsp.  Hi i want to get the tinyUrl value in the scriptlet of jsp...;class=moreRewards&dealID=27"; var tinyUrl; BitlyCB.shortenResponse = function
error call to undefined function mysql_connect
error call to undefined function mysql_connect  what is error call to undefined function mysql_connect
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
main function defnition in class - Java Beginners
main function defnition in class  why do we use public infront of a main function   Hi friend, The main method is similar to the main function in C and C++; it's the entry point for your application
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
How do I set environment variables from Java?
How do I set environment variables from Java?  How do I set environment variables from Java
How can I get specific data from JSON
How can I get specific data from JSON  Hi, How can I get specific data from JSON? Thanks
database call from javaScript - Ajax
database call from javaScript  Dear All, In my project i have one... name. and i have to do this in javascript.How do i call database query ,if suppose i have selected two building from text area,i have to finish
Understanding public static void main function
Understanding public static void main function       The public static void main function is important function in Java programming language. In this section we will learn about main
how can i run ASP.Net Server from netbeans IDE?
how can i run ASP.Net Server from netbeans IDE?  please help me how can i run ASP.Net Server from netbeans IDE? in other word , I have a web services published with IIS7 and I want to use it from my Application My Application
How can i read a file from nth line onwards in java
How can i read a file from nth line onwards in java  Hi, I need to read a file content from its nth line onwards till end. How can i implement it in java. Regards, Chinnu
How can i pass the valus from a JSP to the action class???
How can i pass the valus from a JSP to the action class???  hewllo wevryone... can anyone help me with how i can pass the value of menuId in my JSP and pass it in the action class
How to call business deleget class(EJB) from JSF Page? - Java Server Faces Questions
How to call business deleget class(EJB) from JSF Page?  Hi, How to call a biz i.e. business deleget class(EJB) from JSF Page? I am creating one 3-tier banking application. I am using JSF 1.2 I want to know that.How to call
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
How to load elements from db when i press next.
How to load elements from db when i press next.  Hello , I am working... means when i click next, the next 20 books will be displayed from db on the same page. Hope you got my point , please help me, I am unable to understand how to do
How Can I get ArrayList of Data from jsp with ajax request
How Can I get ArrayList of Data from jsp with ajax request  Hi, I retereved 5 Employee Record of Data from Struts Action class to jsp with ajax response. But I don't how how can reterve this dynamic 5 employee records
How can I learn Data Science from scratch?
How can I learn Data Science from scratch?  Hi, I am beginner... to learn: How can I learn Data Science from scratch? Try to provide me good examples or tutorials links so that I can learn the topic "How can I learn Data

Ads